niwrap.c3d.c3d
1# This file was auto generated by Styx. 2# Do not edit this file directly. 3 4import typing 5import pathlib 6from styxdefs import * 7import dataclasses 8 9C3D_METADATA = Metadata( 10 id="db6e417f06d941414c3d7eb43b166b3cdaa1491d.boutiques", 11 name="c3d", 12 package="c3d", 13 container_image_tag="pyushkevich/itksnap:v3.8.2", 14) 15 16 17@dataclasses.dataclass 18class C3dAccum: 19 """ 20 -accum, -endaccum: Accumulate operations over all images 21 22 Syntax: `-accum command-list -endaccum` 23 24 Apply a binary operation (such as addition or multiplication) to all the 25 images on the stack in a cumulative fashion. The command(s) will be applied 26 to the last and second-to-last images on the stack, then to the result of 27 this operation and the third-to-last image on the stack and so on. Below is 28 the example of using the command to add multiple images. 29 30 c3d image*.nii -accum -add -endaccum -o sum.nii. 31 """ 32 accum: str 33 """-accum, -endaccum: Accumulate operations over all images 34 35 Syntax: `-accum command-list -endaccum` 36 37 Apply a binary operation (such as addition or multiplication) to all the 38 images on the stack in a cumulative fashion. The command(s) will be applied 39 to the last and second-to-last images on the stack, then to the result of 40 this operation and the third-to-last image on the stack and so on. Below is 41 the example of using the command to add multiple images. 42 43 c3d image*.nii -accum -add -endaccum -o sum.nii""" 44 45 def run( 46 self, 47 execution: Execution, 48 ) -> list[str]: 49 """ 50 Build command line arguments. This method is called by the main command. 51 52 Args: 53 execution: The execution object. 54 Returns: 55 Command line arguments 56 """ 57 cargs = [] 58 cargs.extend([ 59 "-accum", 60 self.accum 61 ]) 62 return cargs 63 64 65@dataclasses.dataclass 66class C3dAcos: 67 """ 68 No description found. 69 """ 70 acos: str 71 """No description found.""" 72 73 def run( 74 self, 75 execution: Execution, 76 ) -> list[str]: 77 """ 78 Build command line arguments. This method is called by the main command. 79 80 Args: 81 execution: The execution object. 82 Returns: 83 Command line arguments 84 """ 85 cargs = [] 86 cargs.extend([ 87 "-acos", 88 self.acos 89 ]) 90 return cargs 91 92 93@dataclasses.dataclass 94class C3dAdd: 95 """ 96 -add: Voxelwise image addition 97 98 Syntax: `-add` 99 100 Adds the last two images on the stack, and places the sum at the end of the 101 stack. 102 103 # Add two images: x = a + b 104 c3d a.img b.img -add -o x.img 105 106 # Add three images, x = (a + b) + c in the first example, x = a + (b + c) in 107 the second 108 c3d a.img b.img -add c.img -add -o x.img 109 c3d a.img b.img c.img -add -add -o x.img 110 111 # Subtract two images, using -scale command: x = a - b 112 c3d a.img b.img -scale -1 -add -o x.img. 113 """ 114 add: str 115 """-add: Voxelwise image addition 116 117 Syntax: `-add` 118 119 Adds the last two images on the stack, and places the sum at the end of the 120 stack. 121 122 # Add two images: x = a + b 123 c3d a.img b.img -add -o x.img 124 125 # Add three images, x = (a + b) + c in the first example, x = a + (b + c) in 126 the second 127 c3d a.img b.img -add c.img -add -o x.img 128 c3d a.img b.img c.img -add -add -o x.img 129 130 # Subtract two images, using -scale command: x = a - b 131 c3d a.img b.img -scale -1 -add -o x.img""" 132 133 def run( 134 self, 135 execution: Execution, 136 ) -> list[str]: 137 """ 138 Build command line arguments. This method is called by the main command. 139 140 Args: 141 execution: The execution object. 142 Returns: 143 Command line arguments 144 """ 145 cargs = [] 146 cargs.extend([ 147 "-add", 148 self.add 149 ]) 150 return cargs 151 152 153@dataclasses.dataclass 154class C3dAlignLandmarks: 155 """ 156 -alm, -align-landmarks: Align images based on landmark matching 157 158 Syntax: `-alm dof outfile` 159 160 Performs rigid or affine alignment between to sets of landmark images. A 161 landmark image is an image where for every intensity value, the centroid of 162 all voxels with that intensity represents a landmark. Landmarks can be 163 created using the paintbrush tool in ITK-SNAP (they can be spheres, cubes, 164 etc). The first image on the stack is the target/fixed/reference image, and 165 the second is the moving image. The parameters are the degrees of freedom, 166 which is a number (6 for rigid, 7 for rigid+scale, 12 for affine) and the 167 output matrix file. In this example, we have images **fixed.nii* and 168 **moving.nii** with corresponding landmark images. We use landmarks to align 169 the moving image to the fixed: 170 171 c3d fixed_landmarks.nii moving_landmarks.nii -alm 6 rigid.mat 172 c3d fixed.nii moving.nii -reslice-matrix rigid.mat -o 173 moving_resliced_to_fixed.nii. 174 """ 175 align_landmarks: str 176 """-alm, -align-landmarks: Align images based on landmark matching 177 178 Syntax: `-alm dof outfile` 179 180 Performs rigid or affine alignment between to sets of landmark images. A 181 landmark image is an image where for every intensity value, the centroid of 182 all voxels with that intensity represents a landmark. Landmarks can be 183 created using the paintbrush tool in ITK-SNAP (they can be spheres, cubes, 184 etc). The first image on the stack is the target/fixed/reference image, and 185 the second is the moving image. The parameters are the degrees of freedom, 186 which is a number (6 for rigid, 7 for rigid+scale, 12 for affine) and the 187 output matrix file. In this example, we have images **fixed.nii* and 188 **moving.nii** with corresponding landmark images. We use landmarks to align 189 the moving image to the fixed: 190 191 c3d fixed_landmarks.nii moving_landmarks.nii -alm 6 rigid.mat 192 c3d fixed.nii moving.nii -reslice-matrix rigid.mat -o 193 moving_resliced_to_fixed.nii""" 194 195 def run( 196 self, 197 execution: Execution, 198 ) -> list[str]: 199 """ 200 Build command line arguments. This method is called by the main command. 201 202 Args: 203 execution: The execution object. 204 Returns: 205 Command line arguments 206 """ 207 cargs = [] 208 cargs.extend([ 209 "-align-landmarks", 210 self.align_landmarks 211 ]) 212 return cargs 213 214 215@dataclasses.dataclass 216class C3dAnisotropicDiffusion: 217 """ 218 -add: Voxelwise image addition 219 220 Syntax: `-add` 221 222 Adds the last two images on the stack, and places the sum at the end of the 223 stack. 224 225 # Add two images: x = a + b 226 c3d a.img b.img -add -o x.img 227 228 # Add three images, x = (a + b) + c in the first example, x = a + (b + c) in 229 the second 230 c3d a.img b.img -add c.img -add -o x.img 231 c3d a.img b.img c.img -add -add -o x.img 232 233 # Subtract two images, using -scale command: x = a - b 234 c3d a.img b.img -scale -1 -add -o x.img. 235 """ 236 anisotropic_diffusion: str 237 """-add: Voxelwise image addition 238 239 Syntax: `-add` 240 241 Adds the last two images on the stack, and places the sum at the end of the 242 stack. 243 244 # Add two images: x = a + b 245 c3d a.img b.img -add -o x.img 246 247 # Add three images, x = (a + b) + c in the first example, x = a + (b + c) in 248 the second 249 c3d a.img b.img -add c.img -add -o x.img 250 c3d a.img b.img c.img -add -add -o x.img 251 252 # Subtract two images, using -scale command: x = a - b 253 c3d a.img b.img -scale -1 -add -o x.img""" 254 255 def run( 256 self, 257 execution: Execution, 258 ) -> list[str]: 259 """ 260 Build command line arguments. This method is called by the main command. 261 262 Args: 263 execution: The execution object. 264 Returns: 265 Command line arguments 266 """ 267 cargs = [] 268 cargs.extend([ 269 "-anisotropic-diffusion", 270 self.anisotropic_diffusion 271 ]) 272 return cargs 273 274 275@dataclasses.dataclass 276class C3dAntialias: 277 """ 278 No description found. 279 """ 280 antialias: str 281 """No description found.""" 282 283 def run( 284 self, 285 execution: Execution, 286 ) -> list[str]: 287 """ 288 Build command line arguments. This method is called by the main command. 289 290 Args: 291 execution: The execution object. 292 Returns: 293 Command line arguments 294 """ 295 cargs = [] 296 cargs.extend([ 297 "-antialias", 298 self.antialias 299 ]) 300 return cargs 301 302 303@dataclasses.dataclass 304class C3dSet: 305 """ 306 -as: Assign image at the end of the stack to a variable 307 308 Syntax: `-as var` 309 310 Associates the image currently at the end of the stack with variable name 311 'var'. This allows you to retrieve the image later on the command line using 312 the **-push** command. The **-as** and **-push** commands are useful when 313 you need to use a certain image more than once during a convert3d operation. 314 For example, if you want to compute the distance transform of a binary image 315 and mask it so that the values outside of the binary image region have value 316 0, you would use the following command: 317 318 c3d binary.img -as A -sdt -push A -times -o masked_distance.img. 319 """ 320 set_: str 321 """-as: Assign image at the end of the stack to a variable 322 323 Syntax: `-as var` 324 325 Associates the image currently at the end of the stack with variable name 326 'var'. This allows you to retrieve the image later on the command line using 327 the **-push** command. The **-as** and **-push** commands are useful when 328 you need to use a certain image more than once during a convert3d operation. 329 For example, if you want to compute the distance transform of a binary image 330 and mask it so that the values outside of the binary image region have value 331 0, you would use the following command: 332 333 c3d binary.img -as A -sdt -push A -times -o masked_distance.img""" 334 335 def run( 336 self, 337 execution: Execution, 338 ) -> list[str]: 339 """ 340 Build command line arguments. This method is called by the main command. 341 342 Args: 343 execution: The execution object. 344 Returns: 345 Command line arguments 346 """ 347 cargs = [] 348 cargs.extend([ 349 "-as", 350 self.set_ 351 ]) 352 return cargs 353 354 355@dataclasses.dataclass 356class C3dAsin: 357 """ 358 No description found. 359 """ 360 asin: str 361 """No description found.""" 362 363 def run( 364 self, 365 execution: Execution, 366 ) -> list[str]: 367 """ 368 Build command line arguments. This method is called by the main command. 369 370 Args: 371 execution: The execution object. 372 Returns: 373 Command line arguments 374 """ 375 cargs = [] 376 cargs.extend([ 377 "-asin", 378 self.asin 379 ]) 380 return cargs 381 382 383@dataclasses.dataclass 384class C3dAtan2: 385 """ 386 -atan2: Voxelwise angle from sine and cosine 387 388 Syntax: `-atan2` 389 390 Computes the angle in radians from images containing sine and cosine. This 391 is a voxel-wise operation. It requires two images on the stack (sine 392 followed by cosine): 393 394 c3d sin_theta.nii.gz cos_theta.nii.gz -atan2 -o theta.nii.gz. 395 """ 396 atan2: str 397 """-atan2: Voxelwise angle from sine and cosine 398 399 Syntax: `-atan2` 400 401 Computes the angle in radians from images containing sine and cosine. This 402 is a voxel-wise operation. It requires two images on the stack (sine 403 followed by cosine): 404 405 c3d sin_theta.nii.gz cos_theta.nii.gz -atan2 -o theta.nii.gz""" 406 407 def run( 408 self, 409 execution: Execution, 410 ) -> list[str]: 411 """ 412 Build command line arguments. This method is called by the main command. 413 414 Args: 415 execution: The execution object. 416 Returns: 417 Command line arguments 418 """ 419 cargs = [] 420 cargs.extend([ 421 "-atan2", 422 self.atan2 423 ]) 424 return cargs 425 426 427@dataclasses.dataclass 428class C3dBackground: 429 """ 430 -background: Specify background intensity 431 432 Syntax: `-background <value> ` 433 434 Sets the background intensity for interpolation and other operations where 435 some default background value is needed. Default is 0. 436 """ 437 background: str 438 """-background: Specify background intensity 439 440 Syntax: `-background <value> ` 441 442 Sets the background intensity for interpolation and other operations where 443 some default background value is needed. Default is 0.""" 444 445 def run( 446 self, 447 execution: Execution, 448 ) -> list[str]: 449 """ 450 Build command line arguments. This method is called by the main command. 451 452 Args: 453 execution: The execution object. 454 Returns: 455 Command line arguments 456 """ 457 cargs = [] 458 cargs.extend([ 459 "-background", 460 self.background 461 ]) 462 return cargs 463 464 465@dataclasses.dataclass 466class C3dN4BiasCorrection: 467 """ 468 -biascorr: Automatic MRI bias field correction 469 470 Syntax: `-biascorr` 471 472 Performs automatic bias field correction for MRI images. This feature uses 473 the [N3 implementation in ITK by Dr. Tustison][4], based on the N3 algorithm 474 by Sled et al. 475 476 c3d mri.nii.gz -biascorr -o mricorr.nii.gz. 477 """ 478 n4_bias_correction: str 479 """-biascorr: Automatic MRI bias field correction 480 481 Syntax: `-biascorr` 482 483 Performs automatic bias field correction for MRI images. This feature uses 484 the [N3 implementation in ITK by Dr. Tustison][4], based on the N3 algorithm 485 by Sled et al. 486 487 c3d mri.nii.gz -biascorr -o mricorr.nii.gz""" 488 489 def run( 490 self, 491 execution: Execution, 492 ) -> list[str]: 493 """ 494 Build command line arguments. This method is called by the main command. 495 496 Args: 497 execution: The execution object. 498 Returns: 499 Command line arguments 500 """ 501 cargs = [] 502 cargs.extend([ 503 "-biascorr", 504 self.n4_bias_correction 505 ]) 506 return cargs 507 508 509@dataclasses.dataclass 510class C3dBinarize: 511 """ 512 -binarize: Convert image to binary 513 514 Syntax: `-binarize` 515 516 Converts an image to binary by mapping all background values (the background 517 is 0 by default and can be changed by the option **-background**) to 0 and 518 all non-background values to 1. The **-binarize** command is shorthand for 519 the **-threshold** command. 520 521 c3d test.img -binarize -o binary.img 522 c3d -background 10 -binarize -o binary.img 523 c3d test.img -threshold 10 10 0 1 // equivalent to above command. 524 """ 525 binarize: str 526 """-binarize: Convert image to binary 527 528 Syntax: `-binarize` 529 530 Converts an image to binary by mapping all background values (the background 531 is 0 by default and can be changed by the option **-background**) to 0 and 532 all non-background values to 1. The **-binarize** command is shorthand for 533 the **-threshold** command. 534 535 c3d test.img -binarize -o binary.img 536 c3d -background 10 -binarize -o binary.img 537 c3d test.img -threshold 10 10 0 1 // equivalent to above command""" 538 539 def run( 540 self, 541 execution: Execution, 542 ) -> list[str]: 543 """ 544 Build command line arguments. This method is called by the main command. 545 546 Args: 547 execution: The execution object. 548 Returns: 549 Command line arguments 550 """ 551 cargs = [] 552 cargs.extend([ 553 "-binarize", 554 self.binarize 555 ]) 556 return cargs 557 558 559@dataclasses.dataclass 560class C3dCanny: 561 """ 562 -canny: Canny edge detector 563 564 Syntax: `-canny <sigma_vector> <t_lower> <t_upper>` 565 566 Performs edge detection on the last image on the stack using the Canny 567 filter. The parameters are a vector of standard deviations defining the 568 scale of the edges detected and lower and upper thresholds for edge 569 selection. See documentation on the [ITK Canny Filter][14]. 570 """ 571 canny: str 572 """-canny: Canny edge detector 573 574 Syntax: `-canny <sigma_vector> <t_lower> <t_upper>` 575 576 Performs edge detection on the last image on the stack using the Canny 577 filter. The parameters are a vector of standard deviations defining the 578 scale of the edges detected and lower and upper thresholds for edge 579 selection. See documentation on the [ITK Canny Filter][14].""" 580 581 def run( 582 self, 583 execution: Execution, 584 ) -> list[str]: 585 """ 586 Build command line arguments. This method is called by the main command. 587 588 Args: 589 execution: The execution object. 590 Returns: 591 Command line arguments 592 """ 593 cargs = [] 594 cargs.extend([ 595 "-canny", 596 self.canny 597 ]) 598 return cargs 599 600 601@dataclasses.dataclass 602class C3dCeil: 603 """ 604 -ceil: Round up image intensities 605 606 Syntax: `-ceil ` 607 608 Each image intensity is replaced by the smallest integer larger or equal to 609 it 610 611 c3d input.img -ceil -o output.img. 612 """ 613 ceil: str 614 """-ceil: Round up image intensities 615 616 Syntax: `-ceil ` 617 618 Each image intensity is replaced by the smallest integer larger or equal to 619 it 620 621 c3d input.img -ceil -o output.img""" 622 623 def run( 624 self, 625 execution: Execution, 626 ) -> list[str]: 627 """ 628 Build command line arguments. This method is called by the main command. 629 630 Args: 631 execution: The execution object. 632 Returns: 633 Command line arguments 634 """ 635 cargs = [] 636 cargs.extend([ 637 "-ceil", 638 self.ceil 639 ]) 640 return cargs 641 642 643@dataclasses.dataclass 644class C3dCentroid: 645 """ 646 -centroid: Report centroid of foreground voxels 647 648 Syntax: `-centroid` 649 650 Reports the centroid, in physical coordinates, of all foreground voxels in 651 the image. 652 653 c3d binaryimage.img -centroid // centroid of all non-0 voxels 654 c3d grayimage.img -thresh 1000 7000 1 0 -centroid 1 // centroid of all 655 voxels in range 1000-7000 656 c3d labelimage.img -thresh 5 5 1 0 -centroid // centroid of all voxels with 657 label 5 658 c3d labelimage.img -split -foreach -centroid -endfor // centroids of all 659 labels (including 0). 660 """ 661 centroid: str 662 """-centroid: Report centroid of foreground voxels 663 664 Syntax: `-centroid` 665 666 Reports the centroid, in physical coordinates, of all foreground voxels in 667 the image. 668 669 c3d binaryimage.img -centroid // centroid of all non-0 voxels 670 c3d grayimage.img -thresh 1000 7000 1 0 -centroid 1 // centroid of all 671 voxels in range 1000-7000 672 c3d labelimage.img -thresh 5 5 1 0 -centroid // centroid of all voxels with 673 label 5 674 c3d labelimage.img -split -foreach -centroid -endfor // centroids of all 675 labels (including 0)""" 676 677 def run( 678 self, 679 execution: Execution, 680 ) -> list[str]: 681 """ 682 Build command line arguments. This method is called by the main command. 683 684 Args: 685 execution: The execution object. 686 Returns: 687 Command line arguments 688 """ 689 cargs = [] 690 cargs.extend([ 691 "-centroid", 692 self.centroid 693 ]) 694 return cargs 695 696 697@dataclasses.dataclass 698class C3dCentroidMark: 699 """ 700 -centroid-mark: Mark the centroid of foreground voxels 701 702 Syntax: `-centroid-mark <label>` 703 704 Marks the centroid of the foreground voxels in an image. Unlike 705 **-centroid**, this command does not print the centroid location, but marks 706 the closest voxel in the image with the intensity **label**. The remaining 707 voxels are assigned 0 intensity. Combined with -dilate, this can be used to 708 mark centers of regions with spheres. 709 710 c3d binaryimage.nii -centroid-mark -dilate 1 3x3x3 711 c3d labelimage.nii -split -foreach -centroid-mark -endfor -merge -o 712 centers.nii. 713 """ 714 centroid_mark: str 715 """-centroid-mark: Mark the centroid of foreground voxels 716 717 Syntax: `-centroid-mark <label>` 718 719 Marks the centroid of the foreground voxels in an image. Unlike 720 **-centroid**, this command does not print the centroid location, but marks 721 the closest voxel in the image with the intensity **label**. The remaining 722 voxels are assigned 0 intensity. Combined with -dilate, this can be used to 723 mark centers of regions with spheres. 724 725 c3d binaryimage.nii -centroid-mark -dilate 1 3x3x3 726 c3d labelimage.nii -split -foreach -centroid-mark -endfor -merge -o 727 centers.nii""" 728 729 def run( 730 self, 731 execution: Execution, 732 ) -> list[str]: 733 """ 734 Build command line arguments. This method is called by the main command. 735 736 Args: 737 execution: The execution object. 738 Returns: 739 Command line arguments 740 """ 741 cargs = [] 742 cargs.extend([ 743 "-centroid-mark", 744 self.centroid_mark 745 ]) 746 return cargs 747 748 749@dataclasses.dataclass 750class C3dConnectedComponents: 751 """ 752 -comp, -connected-components: Compute connected components 753 754 Syntax: `-comp` 755 756 Computes the connected components of a binary image. Each connected 757 component is assigned an integer index. Indices are ordered by the size of 758 the component, so the component assigned index 1 is the largest. The 759 background is assigned index 0. To select the largest connected component, 760 combine the call to **-comp** with a call to **-threshold**. 761 762 c3d binary.img -comp -o comp.img 763 c3d binary.img -comp -threshold 1 1 1 0 -o largest_comp.img. 764 """ 765 connected_components: str 766 """-comp, -connected-components: Compute connected components 767 768 Syntax: `-comp` 769 770 Computes the connected components of a binary image. Each connected 771 component is assigned an integer index. Indices are ordered by the size of 772 the component, so the component assigned index 1 is the largest. The 773 background is assigned index 0. To select the largest connected component, 774 combine the call to **-comp** with a call to **-threshold**. 775 776 c3d binary.img -comp -o comp.img 777 c3d binary.img -comp -threshold 1 1 1 0 -o largest_comp.img""" 778 779 def run( 780 self, 781 execution: Execution, 782 ) -> list[str]: 783 """ 784 Build command line arguments. This method is called by the main command. 785 786 Args: 787 execution: The execution object. 788 Returns: 789 Command line arguments 790 """ 791 cargs = [] 792 cargs.extend([ 793 "-connected-components", 794 self.connected_components 795 ]) 796 return cargs 797 798 799@dataclasses.dataclass 800class C3dClear: 801 """ 802 -clear: Clear the image stack 803 804 Syntax: `-clear` 805 806 Clears the image stack. Images assigned a name with the **-as** command will 807 remain in memory. 808 """ 809 clear_: str 810 """-clear: Clear the image stack 811 812 Syntax: `-clear` 813 814 Clears the image stack. Images assigned a name with the **-as** command will 815 remain in memory.""" 816 817 def run( 818 self, 819 execution: Execution, 820 ) -> list[str]: 821 """ 822 Build command line arguments. This method is called by the main command. 823 824 Args: 825 execution: The execution object. 826 Returns: 827 Command line arguments 828 """ 829 cargs = [] 830 cargs.extend([ 831 "-clear", 832 self.clear_ 833 ]) 834 return cargs 835 836 837@dataclasses.dataclass 838class C3dClip: 839 """ 840 -clip: Clip image intensity to range 841 842 Syntax: `-clip iMin iMax` 843 844 Clips image intensities, so that the values below *iMin* are converted to 845 *iMin* and values greater than *iMax* are converted to *iMax*. This is 846 useful for eliminating hyperintensities in images. Values *iMin* and *iMax* 847 are intensity specifications (see below). 848 849 c3d mri.img -clip 1000 8000 -o mriclip01.img // Clips below and above 850 c3d mri.img -clip -inf 8000 -o mriclip02.img // Clips above only 851 c3d mri.img -clip -inf 95% -o mriclip03.img // Clips at 95th percentile. 852 """ 853 clip: str 854 """-clip: Clip image intensity to range 855 856 Syntax: `-clip iMin iMax` 857 858 Clips image intensities, so that the values below *iMin* are converted to 859 *iMin* and values greater than *iMax* are converted to *iMax*. This is 860 useful for eliminating hyperintensities in images. Values *iMin* and *iMax* 861 are intensity specifications (see below). 862 863 c3d mri.img -clip 1000 8000 -o mriclip01.img // Clips below and above 864 c3d mri.img -clip -inf 8000 -o mriclip02.img // Clips above only 865 c3d mri.img -clip -inf 95% -o mriclip03.img // Clips at 95th percentile""" 866 867 def run( 868 self, 869 execution: Execution, 870 ) -> list[str]: 871 """ 872 Build command line arguments. This method is called by the main command. 873 874 Args: 875 execution: The execution object. 876 Returns: 877 Command line arguments 878 """ 879 cargs = [] 880 cargs.extend([ 881 "-clip", 882 self.clip 883 ]) 884 return cargs 885 886 887@dataclasses.dataclass 888class C3dColorMap: 889 """ 890 -color-map, -colormap: Convert scalar image to RGB using color map 891 892 Syntax: `-color-map <ColormapName> [min max]` 893 894 Converts a scalar image to a color (RGB) image using a specified color map. 895 The output of the command are three images, containing the red, green and 896 blue channels of the RGB image. The mapping uses the range of the input 897 image, e.g., using the **jet** color map, the lowest intensity pixel in the 898 image will be mapped to blue, and the highest intesnity pixel will be mapped 899 to red. The admissible color maps are 900 **hot,cool,spring,summer,autumn,winter,copper,jet,hsv,red,green,blue,grey,overunder**. 901 The command can be used with the -omc command to write RGB images. The 902 example below generates a PNG image from a slice in a scalar image. 903 904 c3d scalar.nii.gz -slice z 50% -flip y -color-map jet -type uchar -omc 905 colorslice.png 906 907 By default the full image intensity range is mapped. The optional **min** 908 and **max** parameters can be used to set the range of the color map. 909 910 c3d scalar.nii.gz -slice z 50% -flip y -color-map jet 0 1 -type uchar -omc 911 colorslice.png. 912 """ 913 color_map: str 914 """-color-map, -colormap: Convert scalar image to RGB using color map 915 916 Syntax: `-color-map <ColormapName> [min max]` 917 918 Converts a scalar image to a color (RGB) image using a specified color map. 919 The output of the command are three images, containing the red, green and 920 blue channels of the RGB image. The mapping uses the range of the input 921 image, e.g., using the **jet** color map, the lowest intensity pixel in the 922 image will be mapped to blue, and the highest intesnity pixel will be mapped 923 to red. The admissible color maps are 924 **hot,cool,spring,summer,autumn,winter,copper,jet,hsv,red,green,blue,grey,overunder**. 925 The command can be used with the -omc command to write RGB images. The 926 example below generates a PNG image from a slice in a scalar image. 927 928 c3d scalar.nii.gz -slice z 50% -flip y -color-map jet -type uchar -omc 929 colorslice.png 930 931 By default the full image intensity range is mapped. The optional **min** 932 and **max** parameters can be used to set the range of the color map. 933 934 c3d scalar.nii.gz -slice z 50% -flip y -color-map jet 0 1 -type uchar -omc 935 colorslice.png""" 936 937 def run( 938 self, 939 execution: Execution, 940 ) -> list[str]: 941 """ 942 Build command line arguments. This method is called by the main command. 943 944 Args: 945 execution: The execution object. 946 Returns: 947 Command line arguments 948 """ 949 cargs = [] 950 cargs.extend([ 951 "-colormap", 952 self.color_map 953 ]) 954 return cargs 955 956 957@dataclasses.dataclass 958class C3dCompress: 959 """ 960 -compress, -no-compress: Enable/disable compression for some image files 961 962 Syntax: `-compress` or `-no-compress` 963 964 Turns on compressing for image file formats that support it. For some file 965 formats, like NIFTI (.nii), compression is enabled automatically when the 966 filename includes the **.gz** extension. For other formats, like MetaImage, 967 you need to specify **-compress** to enable compression. The following two 968 commands save the image as compressed NIFTI and MetaImage files: 969 970 c3d input.nii -o output.nii.gz 971 c3d input.nii -compress -o output.mha. 972 """ 973 compress: str 974 """-compress, -no-compress: Enable/disable compression for some image files 975 976 Syntax: `-compress` or `-no-compress` 977 978 Turns on compressing for image file formats that support it. For some file 979 formats, like NIFTI (.nii), compression is enabled automatically when the 980 filename includes the **.gz** extension. For other formats, like MetaImage, 981 you need to specify **-compress** to enable compression. The following two 982 commands save the image as compressed NIFTI and MetaImage files: 983 984 c3d input.nii -o output.nii.gz 985 c3d input.nii -compress -o output.mha""" 986 987 def run( 988 self, 989 execution: Execution, 990 ) -> list[str]: 991 """ 992 Build command line arguments. This method is called by the main command. 993 994 Args: 995 execution: The execution object. 996 Returns: 997 Command line arguments 998 """ 999 cargs = [] 1000 cargs.extend([ 1001 "-compress", 1002 self.compress 1003 ]) 1004 return cargs 1005 1006 1007@dataclasses.dataclass 1008class C3dNoCompress: 1009 """ 1010 -compress, -no-compress: Enable/disable compression for some image files 1011 1012 Syntax: `-compress` or `-no-compress` 1013 1014 Turns on compressing for image file formats that support it. For some file 1015 formats, like NIFTI (.nii), compression is enabled automatically when the 1016 filename includes the **.gz** extension. For other formats, like MetaImage, 1017 you need to specify **-compress** to enable compression. The following two 1018 commands save the image as compressed NIFTI and MetaImage files: 1019 1020 c3d input.nii -o output.nii.gz 1021 c3d input.nii -compress -o output.mha. 1022 """ 1023 no_compress: str 1024 """-compress, -no-compress: Enable/disable compression for some image files 1025 1026 Syntax: `-compress` or `-no-compress` 1027 1028 Turns on compressing for image file formats that support it. For some file 1029 formats, like NIFTI (.nii), compression is enabled automatically when the 1030 filename includes the **.gz** extension. For other formats, like MetaImage, 1031 you need to specify **-compress** to enable compression. The following two 1032 commands save the image as compressed NIFTI and MetaImage files: 1033 1034 c3d input.nii -o output.nii.gz 1035 c3d input.nii -compress -o output.mha""" 1036 1037 def run( 1038 self, 1039 execution: Execution, 1040 ) -> list[str]: 1041 """ 1042 Build command line arguments. This method is called by the main command. 1043 1044 Args: 1045 execution: The execution object. 1046 Returns: 1047 Command line arguments 1048 """ 1049 cargs = [] 1050 cargs.extend([ 1051 "-no-compress", 1052 self.no_compress 1053 ]) 1054 return cargs 1055 1056 1057@dataclasses.dataclass 1058class C3dConv: 1059 """ 1060 -conv: Convolution 1061 1062 Syntax `-conv` 1063 1064 Performs convolution between the last two images on the stack. The 1065 convolution is performed using the Fourier transform. The result is an image 1066 of the same dimensions as the first image. For more details, see ["FFT Based 1067 Convolution" by Gaetan Lehmann][Lehmann]. 1068 1069 c3d image.nii kernel.nii -conv -o result.nii 1070 1071 1072 [Lehmann]: https://hdl.handle.net/10380/3154. 1073 """ 1074 conv: str 1075 """-conv: Convolution 1076 1077 Syntax `-conv` 1078 1079 Performs convolution between the last two images on the stack. The 1080 convolution is performed using the Fourier transform. The result is an image 1081 of the same dimensions as the first image. For more details, see ["FFT Based 1082 Convolution" by Gaetan Lehmann][Lehmann]. 1083 1084 c3d image.nii kernel.nii -conv -o result.nii 1085 1086 1087 [Lehmann]: https://hdl.handle.net/10380/3154""" 1088 1089 def run( 1090 self, 1091 execution: Execution, 1092 ) -> list[str]: 1093 """ 1094 Build command line arguments. This method is called by the main command. 1095 1096 Args: 1097 execution: The execution object. 1098 Returns: 1099 Command line arguments 1100 """ 1101 cargs = [] 1102 cargs.extend([ 1103 "-conv", 1104 self.conv 1105 ]) 1106 return cargs 1107 1108 1109@dataclasses.dataclass 1110class C3dCoordinateMapVoxel: 1111 """ 1112 -cmv, -coordinate-map-voxel: Generate voxel coordinate maps (voxel units) 1113 1114 Syntax: `-cmv` 1115 1116 For a *N*-dimensional image, replaces the last image on the stack with *N* 1117 images. The *k*-th output image at each voxel contains the $k$-th coordinate 1118 of that voxel, in voxel units. 1119 1120 c3d image.nii -cmv -oo coordmap%d.nii.gz 1121 1122 One can use this command to split a brain segmentation image into a left 1123 hemisphere segmentation and a right hemisphere segmentation (assuming the X 1124 coordinate corresponds to the right-left axis) 1125 1126 c3d seg.nii -as SEG -cmv -pop -pop -thresh 50% inf 1 0 -as MASK \ 1127 -push SEG -times -o seg_left.nii.gz \ 1128 -push MASK -replace 1 0 0 1 \ 1129 -push SEG -times -o seg_right.nii.gz. 1130 """ 1131 coordinate_map_voxel: str 1132 """-cmv, -coordinate-map-voxel: Generate voxel coordinate maps (voxel units) 1133 1134 Syntax: `-cmv` 1135 1136 For a *N*-dimensional image, replaces the last image on the stack with *N* 1137 images. The *k*-th output image at each voxel contains the $k$-th coordinate 1138 of that voxel, in voxel units. 1139 1140 c3d image.nii -cmv -oo coordmap%d.nii.gz 1141 1142 One can use this command to split a brain segmentation image into a left 1143 hemisphere segmentation and a right hemisphere segmentation (assuming the X 1144 coordinate corresponds to the right-left axis) 1145 1146 c3d seg.nii -as SEG -cmv -pop -pop -thresh 50% inf 1 0 -as MASK \ 1147 -push SEG -times -o seg_left.nii.gz \ 1148 -push MASK -replace 1 0 0 1 \ 1149 -push SEG -times -o seg_right.nii.gz""" 1150 1151 def run( 1152 self, 1153 execution: Execution, 1154 ) -> list[str]: 1155 """ 1156 Build command line arguments. This method is called by the main command. 1157 1158 Args: 1159 execution: The execution object. 1160 Returns: 1161 Command line arguments 1162 """ 1163 cargs = [] 1164 cargs.extend([ 1165 "-coordinate-map-voxel", 1166 self.coordinate_map_voxel 1167 ]) 1168 return cargs 1169 1170 1171@dataclasses.dataclass 1172class C3dCoordinateMapPhysical: 1173 """ 1174 -cmp, -coordinate-map-physical: Generate voxel coordinate maps (voxel units) 1175 1176 Syntax: `-cmp` 1177 1178 This command is similar to **-cmv** (**-coordinate-map-voxel**), but the 1179 output will contain the physical coordinates of the voxels, in the NIFTI 1180 (RAS) coordinate frame. 1181 """ 1182 coordinate_map_physical: str 1183 """-cmp, -coordinate-map-physical: Generate voxel coordinate maps (voxel 1184 units) 1185 1186 Syntax: `-cmp` 1187 1188 This command is similar to **-cmv** (**-coordinate-map-voxel**), but the 1189 output will contain the physical coordinates of the voxels, in the NIFTI 1190 (RAS) coordinate frame.""" 1191 1192 def run( 1193 self, 1194 execution: Execution, 1195 ) -> list[str]: 1196 """ 1197 Build command line arguments. This method is called by the main command. 1198 1199 Args: 1200 execution: The execution object. 1201 Returns: 1202 Command line arguments 1203 """ 1204 cargs = [] 1205 cargs.extend([ 1206 "-coordinate-map-physical", 1207 self.coordinate_map_physical 1208 ]) 1209 return cargs 1210 1211 1212@dataclasses.dataclass 1213class C3dCopyTransform: 1214 """ 1215 -copy-transform: Copy header information 1216 1217 Syntax: `-copy-transform` 1218 1219 Copies the image header, specifically the image to physical space transform 1220 (origin, spacing, direction cosines), from the first image (reference) to 1221 the second image (target). This is best done with NIFTI images, which store 1222 this information well. In the example below, *out.nii* will have the same 1223 header as *first.nii* and the same intensities as *second.nii*. 1224 1225 c3d first.nii second.nii -copy-transform -o out.nii. 1226 """ 1227 copy_transform: str 1228 """-copy-transform: Copy header information 1229 1230 Syntax: `-copy-transform` 1231 1232 Copies the image header, specifically the image to physical space transform 1233 (origin, spacing, direction cosines), from the first image (reference) to 1234 the second image (target). This is best done with NIFTI images, which store 1235 this information well. In the example below, *out.nii* will have the same 1236 header as *first.nii* and the same intensities as *second.nii*. 1237 1238 c3d first.nii second.nii -copy-transform -o out.nii""" 1239 1240 def run( 1241 self, 1242 execution: Execution, 1243 ) -> list[str]: 1244 """ 1245 Build command line arguments. This method is called by the main command. 1246 1247 Args: 1248 execution: The execution object. 1249 Returns: 1250 Command line arguments 1251 """ 1252 cargs = [] 1253 cargs.extend([ 1254 "-copy-transform", 1255 self.copy_transform 1256 ]) 1257 return cargs 1258 1259 1260@dataclasses.dataclass 1261class C3dCos: 1262 """ 1263 No description found. 1264 """ 1265 cos: str 1266 """No description found.""" 1267 1268 def run( 1269 self, 1270 execution: Execution, 1271 ) -> list[str]: 1272 """ 1273 Build command line arguments. This method is called by the main command. 1274 1275 Args: 1276 execution: The execution object. 1277 Returns: 1278 Command line arguments 1279 """ 1280 cargs = [] 1281 cargs.extend([ 1282 "-cos", 1283 self.cos 1284 ]) 1285 return cargs 1286 1287 1288@dataclasses.dataclass 1289class C3dCreate: 1290 """ 1291 -create: Generate blank image 1292 1293 Syntax: `-create dimensions voxel_size` 1294 1295 Creates a new blank image with specified dimensions and voxel size, and 1296 places it at the end of the stack. The image is set to the current 1297 background value, which is 0 by default but can be overwritten with the 1298 **-background** command. The origin of the image can be changed with the 1299 **-origin** command. 1300 1301 c3d -create 256x256x160 1x1x1mm -o newimage.img 1302 c3d -background 128 -create 256x256x160 1x1x1mm -origin 128x128x80mm -o 1303 newimage.img. 1304 """ 1305 create: str 1306 """-create: Generate blank image 1307 1308 Syntax: `-create dimensions voxel_size` 1309 1310 Creates a new blank image with specified dimensions and voxel size, and 1311 places it at the end of the stack. The image is set to the current 1312 background value, which is 0 by default but can be overwritten with the 1313 **-background** command. The origin of the image can be changed with the 1314 **-origin** command. 1315 1316 c3d -create 256x256x160 1x1x1mm -o newimage.img 1317 c3d -background 128 -create 256x256x160 1x1x1mm -origin 128x128x80mm -o 1318 newimage.img""" 1319 1320 def run( 1321 self, 1322 execution: Execution, 1323 ) -> list[str]: 1324 """ 1325 Build command line arguments. This method is called by the main command. 1326 1327 Args: 1328 execution: The execution object. 1329 Returns: 1330 Command line arguments 1331 """ 1332 cargs = [] 1333 cargs.extend([ 1334 "-create", 1335 self.create 1336 ]) 1337 return cargs 1338 1339 1340@dataclasses.dataclass 1341class C3dDicomSeriesList: 1342 """ 1343 -dicom-series-list: List image series in a DICOM directory 1344 1345 Syntax: `-dicom-series-list <directory> 1346 1347 Prints out a table of DICOM series ids and corresponding image information 1348 to standard output. 1349 """ 1350 dicom_series_list: str 1351 """-dicom-series-list: List image series in a DICOM directory 1352 1353 Syntax: `-dicom-series-list <directory> 1354 1355 Prints out a table of DICOM series ids and corresponding image information 1356 to standard output.""" 1357 1358 def run( 1359 self, 1360 execution: Execution, 1361 ) -> list[str]: 1362 """ 1363 Build command line arguments. This method is called by the main command. 1364 1365 Args: 1366 execution: The execution object. 1367 Returns: 1368 Command line arguments 1369 """ 1370 cargs = [] 1371 cargs.extend([ 1372 "-dicom-series-list", 1373 self.dicom_series_list 1374 ]) 1375 return cargs 1376 1377 1378@dataclasses.dataclass 1379class C3dDicomSeriesRead: 1380 """ 1381 -dicom-series-read: Read a DICOM image series 1382 1383 Syntax: `-dicom-series-read <directory> <series_id>` 1384 1385 Imports a specific DICOM image series from a directory containing DICOM 1386 files. The **directory** parameter may also point to one of the DICOM files 1387 in the directory. 1388 The **seried_id** is a string identifier for the series that can be obtained 1389 by calling **-dicom-series-list**. 1390 """ 1391 dicom_series_read: str 1392 """-dicom-series-read: Read a DICOM image series 1393 1394 Syntax: `-dicom-series-read <directory> <series_id>` 1395 1396 Imports a specific DICOM image series from a directory containing DICOM 1397 files. The **directory** parameter may also point to one of the DICOM files 1398 in the directory. 1399 The **seried_id** is a string identifier for the series that can be obtained 1400 by calling **-dicom-series-list**""" 1401 1402 def run( 1403 self, 1404 execution: Execution, 1405 ) -> list[str]: 1406 """ 1407 Build command line arguments. This method is called by the main command. 1408 1409 Args: 1410 execution: The execution object. 1411 Returns: 1412 Command line arguments 1413 """ 1414 cargs = [] 1415 cargs.extend([ 1416 "-dicom-series-read", 1417 self.dicom_series_read 1418 ]) 1419 return cargs 1420 1421 1422@dataclasses.dataclass 1423class C3dDilate: 1424 """ 1425 -dilate: Binary dilation 1426 1427 Syntax: `-dilate <label> <radius_vector>` 1428 1429 Applies the dilation [mathematical morphology][5] operation to a binary 1430 image. The first parameter is the intensity value of the object that is to 1431 be dilated. The second is the radius of the dilation structuring element in 1432 3D. 1433 1434 c3d binary.img -dilate 255 3x3x3vox -o newimage.img. 1435 """ 1436 dilate: str 1437 """-dilate: Binary dilation 1438 1439 Syntax: `-dilate <label> <radius_vector>` 1440 1441 Applies the dilation [mathematical morphology][5] operation to a binary 1442 image. The first parameter is the intensity value of the object that is to 1443 be dilated. The second is the radius of the dilation structuring element in 1444 3D. 1445 1446 c3d binary.img -dilate 255 3x3x3vox -o newimage.img""" 1447 1448 def run( 1449 self, 1450 execution: Execution, 1451 ) -> list[str]: 1452 """ 1453 Build command line arguments. This method is called by the main command. 1454 1455 Args: 1456 execution: The execution object. 1457 Returns: 1458 Command line arguments 1459 """ 1460 cargs = [] 1461 cargs.extend([ 1462 "-dilate", 1463 self.dilate 1464 ]) 1465 return cargs 1466 1467 1468@dataclasses.dataclass 1469class C3dDivide: 1470 """ 1471 -divide: Voxelwise image division 1472 1473 Syntax: `-divide` 1474 1475 Divides one image by another. For instance to compute C = A / B, use the 1476 command 1477 1478 c3d A.img B.img -divide -o C.img 1479 1480 Divison may generate infinite and not-a-number (NaN) values if B contains 1481 zeros. You can use **-replace** to get rid of these values 1482 1483 c3d A.img B.img -divide -replace inf 1000 -inf -1000 NaN 0 -o C2.img. 1484 """ 1485 divide: str 1486 """-divide: Voxelwise image division 1487 1488 Syntax: `-divide` 1489 1490 Divides one image by another. For instance to compute C = A / B, use the 1491 command 1492 1493 c3d A.img B.img -divide -o C.img 1494 1495 Divison may generate infinite and not-a-number (NaN) values if B contains 1496 zeros. You can use **-replace** to get rid of these values 1497 1498 c3d A.img B.img -divide -replace inf 1000 -inf -1000 NaN 0 -o C2.img""" 1499 1500 def run( 1501 self, 1502 execution: Execution, 1503 ) -> list[str]: 1504 """ 1505 Build command line arguments. This method is called by the main command. 1506 1507 Args: 1508 execution: The execution object. 1509 Returns: 1510 Command line arguments 1511 """ 1512 cargs = [] 1513 cargs.extend([ 1514 "-divide", 1515 self.divide 1516 ]) 1517 return cargs 1518 1519 1520@dataclasses.dataclass 1521class C3dDuplicate: 1522 """ 1523 -dup: Duplicate the last image on the stack 1524 1525 Syntax: `-dup` 1526 1527 Duplicates the image at the end of the stack. This is equivalent to **-as 1528 var -push var**, but shorter. An example is when you want to pass an image 1529 as both arguments to a binary operator, e.g., computing the square of the 1530 image intensity: 1531 1532 c3d input.img -dup -times -o square.img 1533 1534 ### Commands: Voxelwise Calculations. 1535 """ 1536 duplicate: str 1537 """-dup: Duplicate the last image on the stack 1538 1539 Syntax: `-dup` 1540 1541 Duplicates the image at the end of the stack. This is equivalent to **-as 1542 var -push var**, but shorter. An example is when you want to pass an image 1543 as both arguments to a binary operator, e.g., computing the square of the 1544 image intensity: 1545 1546 c3d input.img -dup -times -o square.img 1547 1548 ### Commands: Voxelwise Calculations""" 1549 1550 def run( 1551 self, 1552 execution: Execution, 1553 ) -> list[str]: 1554 """ 1555 Build command line arguments. This method is called by the main command. 1556 1557 Args: 1558 execution: The execution object. 1559 Returns: 1560 Command line arguments 1561 """ 1562 cargs = [] 1563 cargs.extend([ 1564 "-dup", 1565 self.duplicate 1566 ]) 1567 return cargs 1568 1569 1570@dataclasses.dataclass 1571class C3dEndaccum: 1572 """ 1573 -accum, -endaccum: Accumulate operations over all images 1574 1575 Syntax: `-accum command-list -endaccum` 1576 1577 Apply a binary operation (such as addition or multiplication) to all the 1578 images on the stack in a cumulative fashion. The command(s) will be applied 1579 to the last and second-to-last images on the stack, then to the result of 1580 this operation and the third-to-last image on the stack and so on. Below is 1581 the example of using the command to add multiple images. 1582 1583 c3d image*.nii -accum -add -endaccum -o sum.nii. 1584 """ 1585 endaccum: str 1586 """-accum, -endaccum: Accumulate operations over all images 1587 1588 Syntax: `-accum command-list -endaccum` 1589 1590 Apply a binary operation (such as addition or multiplication) to all the 1591 images on the stack in a cumulative fashion. The command(s) will be applied 1592 to the last and second-to-last images on the stack, then to the result of 1593 this operation and the third-to-last image on the stack and so on. Below is 1594 the example of using the command to add multiple images. 1595 1596 c3d image*.nii -accum -add -endaccum -o sum.nii""" 1597 1598 def run( 1599 self, 1600 execution: Execution, 1601 ) -> list[str]: 1602 """ 1603 Build command line arguments. This method is called by the main command. 1604 1605 Args: 1606 execution: The execution object. 1607 Returns: 1608 Command line arguments 1609 """ 1610 cargs = [] 1611 cargs.extend([ 1612 "-endaccum", 1613 self.endaccum 1614 ]) 1615 return cargs 1616 1617 1618@dataclasses.dataclass 1619class C3dEndfor: 1620 """ 1621 -foreach, -endfor: Loop commands over all images on the stack 1622 1623 Syntax: `-foreach commands-list -endfor` 1624 1625 This command forces the commands between **-foreach** and **-endfor** to be 1626 applied to every image on the stack. The main use of this command is to 1627 automate processing of multiple datasets. For example, 1628 1629 c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii. 1630 """ 1631 endfor: str 1632 """-foreach, -endfor: Loop commands over all images on the stack 1633 1634 Syntax: `-foreach commands-list -endfor` 1635 1636 This command forces the commands between **-foreach** and **-endfor** to be 1637 applied to every image on the stack. The main use of this command is to 1638 automate processing of multiple datasets. For example, 1639 1640 c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii""" 1641 1642 def run( 1643 self, 1644 execution: Execution, 1645 ) -> list[str]: 1646 """ 1647 Build command line arguments. This method is called by the main command. 1648 1649 Args: 1650 execution: The execution object. 1651 Returns: 1652 Command line arguments 1653 """ 1654 cargs = [] 1655 cargs.extend([ 1656 "-endfor", 1657 self.endfor 1658 ]) 1659 return cargs 1660 1661 1662@dataclasses.dataclass 1663class C3dErode: 1664 """ 1665 -erode: Binary erosion 1666 1667 Syntax: `-erode <label> <radius_vector>` 1668 1669 Applies erosion [mathematical morphology][5] operation to a binary image. 1670 The first parameter is the intensity value of the object that is to be 1671 eroded. The second is the radius of the erosion structuring element in 3D. 1672 1673 c3d binary.img -erode 255 3x3x3vox -o newimage.img. 1674 """ 1675 erode: str 1676 """-erode: Binary erosion 1677 1678 Syntax: `-erode <label> <radius_vector>` 1679 1680 Applies erosion [mathematical morphology][5] operation to a binary image. 1681 The first parameter is the intensity value of the object that is to be 1682 eroded. The second is the radius of the erosion structuring element in 3D. 1683 1684 c3d binary.img -erode 255 3x3x3vox -o newimage.img""" 1685 1686 def run( 1687 self, 1688 execution: Execution, 1689 ) -> list[str]: 1690 """ 1691 Build command line arguments. This method is called by the main command. 1692 1693 Args: 1694 execution: The execution object. 1695 Returns: 1696 Command line arguments 1697 """ 1698 cargs = [] 1699 cargs.extend([ 1700 "-erode", 1701 self.erode 1702 ]) 1703 return cargs 1704 1705 1706@dataclasses.dataclass 1707class C3dErf: 1708 """ 1709 -erf: Standard error function 1710 1711 Syntax: `-erf mu sigma` 1712 1713 Computes the standard error function. This is useful for applying soft 1714 thresholds. The function computes y = erf((x - mu)/sigma). 1715 1716 c3d input.img -erf 5 2 -o erf.img. 1717 """ 1718 erf: str 1719 """-erf: Standard error function 1720 1721 Syntax: `-erf mu sigma` 1722 1723 Computes the standard error function. This is useful for applying soft 1724 thresholds. The function computes y = erf((x - mu)/sigma). 1725 1726 c3d input.img -erf 5 2 -o erf.img""" 1727 1728 def run( 1729 self, 1730 execution: Execution, 1731 ) -> list[str]: 1732 """ 1733 Build command line arguments. This method is called by the main command. 1734 1735 Args: 1736 execution: The execution object. 1737 Returns: 1738 Command line arguments 1739 """ 1740 cargs = [] 1741 cargs.extend([ 1742 "-erf", 1743 self.erf 1744 ]) 1745 return cargs 1746 1747 1748@dataclasses.dataclass 1749class C3dExp: 1750 """ 1751 -exp: Voxelwise natural exponent 1752 1753 Syntax: `-exp` 1754 1755 Computes exponent of each voxel in the last image on the stack. 1756 1757 c3d input.img -exp -o output.img. 1758 """ 1759 exp: str 1760 """-exp: Voxelwise natural exponent 1761 1762 Syntax: `-exp` 1763 1764 Computes exponent of each voxel in the last image on the stack. 1765 1766 c3d input.img -exp -o output.img""" 1767 1768 def run( 1769 self, 1770 execution: Execution, 1771 ) -> list[str]: 1772 """ 1773 Build command line arguments. This method is called by the main command. 1774 1775 Args: 1776 execution: The execution object. 1777 Returns: 1778 Command line arguments 1779 """ 1780 cargs = [] 1781 cargs.extend([ 1782 "-exp", 1783 self.exp 1784 ]) 1785 return cargs 1786 1787 1788@dataclasses.dataclass 1789class C3dExportPatches: 1790 """ 1791 -export-patches, -xp: Fixed size patch sampling from masked regions 1792 1793 Syntax: `-export-patches <outfile> <radius_vector> <frequency>` 1794 1795 See also: **-export-patches-aug (-xpa)** command, which provides data 1796 augmentation for deep learning. 1797 1798 This command samples patches from a region of a ND image and stores them 1799 into a data file that can be read easily in other software, for example, 1800 NumPy. This is useful for generating training data for machine learning 1801 projects. Multiple "channels" can be sampled. 1802 1803 c3d chan1.nii chan2.nii chan3.nii mask.nii -xp samples.dat 4x4x4 100 1804 1805 This command will sample the three images chan1, chan2, chan3 at foreground 1806 voxels in the mask. Voxels in the mask foreground region are sampled 1807 randomly, following a uniform distribution. The value of 100 means that 1808 every 100-th voxel, on average, is sampled. The radius 4x4x4 means that 1809 patches of size 9x9x9 will be generated. For each sampled voxel, the sampled 1810 intensity data is represented as a 3x9x9x9 array in this example. 1811 1812 To read these samples in NumPy use the following code 1813 1814 dims = (9,9,9) # Patch dimensions 1815 k = 3 # Number of channels 1816 bps = (4 * k * reduce(mul, dims, 1)) # Bytes per sample 1817 np = os.path.getsize(fname) // bps # Number of samples 1818 arr = numpy.memmap(fname,'float32','r',shape=(np,k) + dims) 1819 1820 It is also possible to visualize the extracted samples in ITK-SNAP by 1821 reading them as a raw image, with dimensions equal to the dimensions of the 1822 patch, and the z-dimension multiplied by the number of samples. 1823 1824 The command can also be used to extract entire structures. For example, if 1825 we have a binary segmentation of a lesion of an approximately known size in 1826 an MRI scan, we can extract a patch of given size centered on this lesion, 1827 as follows: 1828 1829 c3d mri.nii lesion_seg.nii -centroid-mark 1 -xp single_sample.dat 50x50x20 1 1830 1831 In the above example, **-centroid-mark** transforms the lesion segmentation 1832 into a single-voxel mask, from which the sample from the MRI is taken. 1833 """ 1834 export_patches: str 1835 """-export-patches, -xp: Fixed size patch sampling from masked regions 1836 1837 Syntax: `-export-patches <outfile> <radius_vector> <frequency>` 1838 1839 See also: **-export-patches-aug (-xpa)** command, which provides data 1840 augmentation for deep learning. 1841 1842 This command samples patches from a region of a ND image and stores them 1843 into a data file that can be read easily in other software, for example, 1844 NumPy. This is useful for generating training data for machine learning 1845 projects. Multiple "channels" can be sampled. 1846 1847 c3d chan1.nii chan2.nii chan3.nii mask.nii -xp samples.dat 4x4x4 100 1848 1849 This command will sample the three images chan1, chan2, chan3 at foreground 1850 voxels in the mask. Voxels in the mask foreground region are sampled 1851 randomly, following a uniform distribution. The value of 100 means that 1852 every 100-th voxel, on average, is sampled. The radius 4x4x4 means that 1853 patches of size 9x9x9 will be generated. For each sampled voxel, the sampled 1854 intensity data is represented as a 3x9x9x9 array in this example. 1855 1856 To read these samples in NumPy use the following code 1857 1858 dims = (9,9,9) # Patch dimensions 1859 k = 3 # Number of channels 1860 bps = (4 * k * reduce(mul, dims, 1)) # Bytes per sample 1861 np = os.path.getsize(fname) // bps # Number of samples 1862 arr = numpy.memmap(fname,'float32','r',shape=(np,k) + dims) 1863 1864 It is also possible to visualize the extracted samples in ITK-SNAP by 1865 reading them as a raw image, with dimensions equal to the dimensions of the 1866 patch, and the z-dimension multiplied by the number of samples. 1867 1868 The command can also be used to extract entire structures. For example, if 1869 we have a binary segmentation of a lesion of an approximately known size in 1870 an MRI scan, we can extract a patch of given size centered on this lesion, 1871 as follows: 1872 1873 c3d mri.nii lesion_seg.nii -centroid-mark 1 -xp single_sample.dat 50x50x20 1 1874 1875 In the above example, **-centroid-mark** transforms the lesion segmentation 1876 into a single-voxel mask, from which the sample from the MRI is taken.""" 1877 1878 def run( 1879 self, 1880 execution: Execution, 1881 ) -> list[str]: 1882 """ 1883 Build command line arguments. This method is called by the main command. 1884 1885 Args: 1886 execution: The execution object. 1887 Returns: 1888 Command line arguments 1889 """ 1890 cargs = [] 1891 cargs.extend([ 1892 "-export-patches", 1893 self.export_patches 1894 ]) 1895 return cargs 1896 1897 1898@dataclasses.dataclass 1899class C3dExportPatchesAug: 1900 """ 1901 -export-patches-aug, -xpa: data augmentation for deep learning 1902 1903 Syntax `-export-patches-aug <N> <sigma_angle>` 1904 1905 This command must precede the `-export-patches (-xp)` command and instructs 1906 this command to not only sample patches along the image axes but to also 1907 sample **N** randomly rotated patches. Rotation is around a uniformly 1908 distributed axis with a rotation angle distributed normally with teh 1909 standard deviation **sigma_angle**, specified in degrees. This kind of 1910 sampling is useful for data augmentation for machine learning algorithms. 1911 1912 c3d chan1.nii chan2.nii chan3.nii mask.nii -xpa 5 10 -xp samples.dat 4x4x4 1913 100. 1914 """ 1915 export_patches_aug: str 1916 """-export-patches-aug, -xpa: data augmentation for deep learning 1917 1918 Syntax `-export-patches-aug <N> <sigma_angle>` 1919 1920 This command must precede the `-export-patches (-xp)` command and instructs 1921 this command to not only sample patches along the image axes but to also 1922 sample **N** randomly rotated patches. Rotation is around a uniformly 1923 distributed axis with a rotation angle distributed normally with teh 1924 standard deviation **sigma_angle**, specified in degrees. This kind of 1925 sampling is useful for data augmentation for machine learning algorithms. 1926 1927 c3d chan1.nii chan2.nii chan3.nii mask.nii -xpa 5 10 -xp samples.dat 4x4x4 1928 100""" 1929 1930 def run( 1931 self, 1932 execution: Execution, 1933 ) -> list[str]: 1934 """ 1935 Build command line arguments. This method is called by the main command. 1936 1937 Args: 1938 execution: The execution object. 1939 Returns: 1940 Command line arguments 1941 """ 1942 cargs = [] 1943 cargs.extend([ 1944 "-export-patches-aug", 1945 self.export_patches_aug 1946 ]) 1947 return cargs 1948 1949 1950@dataclasses.dataclass 1951class C3dExtrudeSeg: 1952 """ 1953 No description found. 1954 """ 1955 extrude_seg: str 1956 """No description found.""" 1957 1958 def run( 1959 self, 1960 execution: Execution, 1961 ) -> list[str]: 1962 """ 1963 Build command line arguments. This method is called by the main command. 1964 1965 Args: 1966 execution: The execution object. 1967 Returns: 1968 Command line arguments 1969 """ 1970 cargs = [] 1971 cargs.extend([ 1972 "-extrude-seg", 1973 self.extrude_seg 1974 ]) 1975 return cargs 1976 1977 1978@dataclasses.dataclass 1979class C3dFillBackgroundWithNoise: 1980 """ 1981 No description found. 1982 """ 1983 fill_background_with_noise: str 1984 """No description found.""" 1985 1986 def run( 1987 self, 1988 execution: Execution, 1989 ) -> list[str]: 1990 """ 1991 Build command line arguments. This method is called by the main command. 1992 1993 Args: 1994 execution: The execution object. 1995 Returns: 1996 Command line arguments 1997 """ 1998 cargs = [] 1999 cargs.extend([ 2000 "-fill-background-with-noise", 2001 self.fill_background_with_noise 2002 ]) 2003 return cargs 2004 2005 2006@dataclasses.dataclass 2007class C3dFft: 2008 """ 2009 -fft: Fast Fourier transform 2010 2011 Syntax `-fft` 2012 2013 Computes the Fourier transform of a real-valued image at the end of the 2014 stack. The image is replaced by the real and imaginary components of the 2015 FFT. This command is only available if **convert3d** is compiled with the 2016 FFTW library support. 2017 2018 c3d image.nii -fft -oo real.nii imag.nii. 2019 """ 2020 fft: str 2021 """-fft: Fast Fourier transform 2022 2023 Syntax `-fft` 2024 2025 Computes the Fourier transform of a real-valued image at the end of the 2026 stack. The image is replaced by the real and imaginary components of the 2027 FFT. This command is only available if **convert3d** is compiled with the 2028 FFTW library support. 2029 2030 c3d image.nii -fft -oo real.nii imag.nii""" 2031 2032 def run( 2033 self, 2034 execution: Execution, 2035 ) -> list[str]: 2036 """ 2037 Build command line arguments. This method is called by the main command. 2038 2039 Args: 2040 execution: The execution object. 2041 Returns: 2042 Command line arguments 2043 """ 2044 cargs = [] 2045 cargs.extend([ 2046 "-fft", 2047 self.fft 2048 ]) 2049 return cargs 2050 2051 2052@dataclasses.dataclass 2053class C3dFlip: 2054 """ 2055 -flip: Flip image around an axis 2056 2057 Syntax: `-flip axes` 2058 2059 Flips the image around specified axes. The parameter 'axes' may be any 2060 combination of characters 'x', 'y', and 'z'; the order does not matter. 2061 2062 c3d input.img -flip xy -o output.img. 2063 """ 2064 flip: str 2065 """-flip: Flip image around an axis 2066 2067 Syntax: `-flip axes` 2068 2069 Flips the image around specified axes. The parameter 'axes' may be any 2070 combination of characters 'x', 'y', and 'z'; the order does not matter. 2071 2072 c3d input.img -flip xy -o output.img""" 2073 2074 def run( 2075 self, 2076 execution: Execution, 2077 ) -> list[str]: 2078 """ 2079 Build command line arguments. This method is called by the main command. 2080 2081 Args: 2082 execution: The execution object. 2083 Returns: 2084 Command line arguments 2085 """ 2086 cargs = [] 2087 cargs.extend([ 2088 "-flip", 2089 self.flip 2090 ]) 2091 return cargs 2092 2093 2094@dataclasses.dataclass 2095class C3dFloor: 2096 """ 2097 -floor: Round down image intensities 2098 2099 Syntax: `-floor ` 2100 2101 Each image intensity is replaced by the largest integer smaller or equal to 2102 it. 2103 2104 c3d input.img -floor -o output.img 2105 2106 To round each intensity to the closest integer, use 2107 2108 c3d input.img -shift 0.5 -floor. 2109 """ 2110 floor: str 2111 """-floor: Round down image intensities 2112 2113 Syntax: `-floor ` 2114 2115 Each image intensity is replaced by the largest integer smaller or equal to 2116 it. 2117 2118 c3d input.img -floor -o output.img 2119 2120 To round each intensity to the closest integer, use 2121 2122 c3d input.img -shift 0.5 -floor""" 2123 2124 def run( 2125 self, 2126 execution: Execution, 2127 ) -> list[str]: 2128 """ 2129 Build command line arguments. This method is called by the main command. 2130 2131 Args: 2132 execution: The execution object. 2133 Returns: 2134 Command line arguments 2135 """ 2136 cargs = [] 2137 cargs.extend([ 2138 "-floor", 2139 self.floor 2140 ]) 2141 return cargs 2142 2143 2144@dataclasses.dataclass 2145class C3dForeach: 2146 """ 2147 -foreach, -endfor: Loop commands over all images on the stack 2148 2149 Syntax: `-foreach commands-list -endfor` 2150 2151 This command forces the commands between **-foreach** and **-endfor** to be 2152 applied to every image on the stack. The main use of this command is to 2153 automate processing of multiple datasets. For example, 2154 2155 c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii. 2156 """ 2157 foreach: str 2158 """-foreach, -endfor: Loop commands over all images on the stack 2159 2160 Syntax: `-foreach commands-list -endfor` 2161 2162 This command forces the commands between **-foreach** and **-endfor** to be 2163 applied to every image on the stack. The main use of this command is to 2164 automate processing of multiple datasets. For example, 2165 2166 c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii""" 2167 2168 def run( 2169 self, 2170 execution: Execution, 2171 ) -> list[str]: 2172 """ 2173 Build command line arguments. This method is called by the main command. 2174 2175 Args: 2176 execution: The execution object. 2177 Returns: 2178 Command line arguments 2179 """ 2180 cargs = [] 2181 cargs.extend([ 2182 "-foreach", 2183 self.foreach 2184 ]) 2185 return cargs 2186 2187 2188@dataclasses.dataclass 2189class C3dForeachComp: 2190 """ 2191 -foreach-comp, -endfor: Loop commands over components of a multi-component 2192 image 2193 2194 Syntax `-foreach-comp <N> commands-list -endfor` 2195 2196 This command runs the list of commands separately for each component of a 2197 set of multi-component images loaded with -mcs. This makes it possible to 2198 perform component-wise operations on multi-component images. For example, it 2199 can be used to average several multi-component images. If the image stack 2200 contains images *x1* *y1* *z1* *x2* *y2* *z2*, then the operations will be 2201 run on *[x1,x2]*, *[y1,y2]*, *[z1,z2]*. For example, if multi_1.nii to 2202 multi_10.nii are three-component images, then the mean three-component image 2203 is given by 2204 2205 c2d -mcs multi_*.nii -foreach-comp -mean -endfor -omc multi_mean.nii. 2206 """ 2207 foreach_comp: str 2208 """-foreach-comp, -endfor: Loop commands over components of a 2209 multi-component image 2210 2211 Syntax `-foreach-comp <N> commands-list -endfor` 2212 2213 This command runs the list of commands separately for each component of a 2214 set of multi-component images loaded with -mcs. This makes it possible to 2215 perform component-wise operations on multi-component images. For example, it 2216 can be used to average several multi-component images. If the image stack 2217 contains images *x1* *y1* *z1* *x2* *y2* *z2*, then the operations will be 2218 run on *[x1,x2]*, *[y1,y2]*, *[z1,z2]*. For example, if multi_1.nii to 2219 multi_10.nii are three-component images, then the mean three-component image 2220 is given by 2221 2222 c2d -mcs multi_*.nii -foreach-comp -mean -endfor -omc multi_mean.nii""" 2223 2224 def run( 2225 self, 2226 execution: Execution, 2227 ) -> list[str]: 2228 """ 2229 Build command line arguments. This method is called by the main command. 2230 2231 Args: 2232 execution: The execution object. 2233 Returns: 2234 Command line arguments 2235 """ 2236 cargs = [] 2237 cargs.extend([ 2238 "-foreach-comp", 2239 self.foreach_comp 2240 ]) 2241 return cargs 2242 2243 2244@dataclasses.dataclass 2245class C3dGlm: 2246 """ 2247 -glm: General linear model 2248 2249 Syntax: `-glm design_matrix_file contrast_vector_file` 2250 2251 Applies voxel-wise general linear model to a set of images. More precisely, 2252 the general linear model solves the following system: $Y = X \beta + 2253 \epsilon$, where Y are the observations (a list of n images, where each 2254 voxel is treated as an independent observation); X is the $n x k$ design 2255 matrix, where $k$ is the number of factors; $\beta$ is a set of $k$ unknown 2256 images (factors) and $\epsilon$ is the error term. The command will compute 2257 the $\beta$ images and return a weighted sum of them, where the weights are 2258 specified in the contrast vector. The design matrix and the contrast vector 2259 are passed in as files. The file format is just a space-separated list of 2260 numbers. For a good explanation of the general linear model, see [S. Kiebel 2261 and A. Holmes, General Linear Model, in Ashburner, Friston, Holmes eds., 2262 *Human Brain Function, 2nd Edition*][6]. The example below computes the 2263 regression coefficient between a set of longitudinal images and subject's 2264 age: 2265 2266 echo "1 67.00" > design_mat.txt 2267 echo "1 75.00" >> design_mat.txt 2268 echo "1 80.00" >> design_mat.txt 2269 echo "1 83.00" >> design_mat.txt 2270 echo "0 1" >> contrast_vec.txt 2271 c3d time1.img time2.img time3.img time4.img -glm design_mat.txt 2272 contrast_vec.txt -o regress.img. 2273 """ 2274 glm: str 2275 """-glm: General linear model 2276 2277 Syntax: `-glm design_matrix_file contrast_vector_file` 2278 2279 Applies voxel-wise general linear model to a set of images. More precisely, 2280 the general linear model solves the following system: $Y = X \beta + 2281 \epsilon$, where Y are the observations (a list of n images, where each 2282 voxel is treated as an independent observation); X is the $n x k$ design 2283 matrix, where $k$ is the number of factors; $\beta$ is a set of $k$ unknown 2284 images (factors) and $\epsilon$ is the error term. The command will compute 2285 the $\beta$ images and return a weighted sum of them, where the weights are 2286 specified in the contrast vector. The design matrix and the contrast vector 2287 are passed in as files. The file format is just a space-separated list of 2288 numbers. For a good explanation of the general linear model, see [S. Kiebel 2289 and A. Holmes, General Linear Model, in Ashburner, Friston, Holmes eds., 2290 *Human Brain Function, 2nd Edition*][6]. The example below computes the 2291 regression coefficient between a set of longitudinal images and subject's 2292 age: 2293 2294 echo "1 67.00" > design_mat.txt 2295 echo "1 75.00" >> design_mat.txt 2296 echo "1 80.00" >> design_mat.txt 2297 echo "1 83.00" >> design_mat.txt 2298 echo "0 1" >> contrast_vec.txt 2299 c3d time1.img time2.img time3.img time4.img -glm design_mat.txt 2300 contrast_vec.txt -o regress.img""" 2301 2302 def run( 2303 self, 2304 execution: Execution, 2305 ) -> list[str]: 2306 """ 2307 Build command line arguments. This method is called by the main command. 2308 2309 Args: 2310 execution: The execution object. 2311 Returns: 2312 Command line arguments 2313 """ 2314 cargs = [] 2315 cargs.extend([ 2316 "-glm", 2317 self.glm 2318 ]) 2319 return cargs 2320 2321 2322@dataclasses.dataclass 2323class C3dGradient: 2324 """ 2325 -grad, -gradient: Image gradient 2326 2327 Syntax `-grad` 2328 2329 Computes the gradient of the image. Each component of the gradient is placed 2330 on the stack in order (x,y,z). The gradient is computed in physical RAS 2331 coordinates, taking into account image spacing and orientation. In other 2332 words, the gradient is the vector in physical space orthogonal to the 2333 isocontours of the image. No smoothing is performed, so it is a good idea to 2334 smooth the image first before computing the gradient. 2335 2336 c3d myimage.nii -smooth 1.2vox -grad -oo grad_comp_%02d.nii. 2337 """ 2338 gradient: str 2339 """-grad, -gradient: Image gradient 2340 2341 Syntax `-grad` 2342 2343 Computes the gradient of the image. Each component of the gradient is placed 2344 on the stack in order (x,y,z). The gradient is computed in physical RAS 2345 coordinates, taking into account image spacing and orientation. In other 2346 words, the gradient is the vector in physical space orthogonal to the 2347 isocontours of the image. No smoothing is performed, so it is a good idea to 2348 smooth the image first before computing the gradient. 2349 2350 c3d myimage.nii -smooth 1.2vox -grad -oo grad_comp_%02d.nii""" 2351 2352 def run( 2353 self, 2354 execution: Execution, 2355 ) -> list[str]: 2356 """ 2357 Build command line arguments. This method is called by the main command. 2358 2359 Args: 2360 execution: The execution object. 2361 Returns: 2362 Command line arguments 2363 """ 2364 cargs = [] 2365 cargs.extend([ 2366 "-grad", 2367 self.gradient 2368 ]) 2369 return cargs 2370 2371 2372@dataclasses.dataclass 2373class C3dHelp: 2374 """ 2375 -hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix 2376 2377 Syntax `-hesseig <scale>` 2378 2379 Computes the Hessian matrix at every pixel of an image and the eigenvalues 2380 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 2381 the stack. These images are useful as texture features. See also the 2382 '''-steig''' command. The scale determines the amount of Gaussian smoothing 2383 applied for computing the partial derivatives in the Hessian, and is in 2384 physical (mm) units. 2385 2386 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz. 2387 """ 2388 v__help: str 2389 """-hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix 2390 2391 Syntax `-hesseig <scale>` 2392 2393 Computes the Hessian matrix at every pixel of an image and the eigenvalues 2394 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 2395 the stack. These images are useful as texture features. See also the 2396 '''-steig''' command. The scale determines the amount of Gaussian smoothing 2397 applied for computing the partial derivatives in the Hessian, and is in 2398 physical (mm) units. 2399 2400 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz""" 2401 2402 def run( 2403 self, 2404 execution: Execution, 2405 ) -> list[str]: 2406 """ 2407 Build command line arguments. This method is called by the main command. 2408 2409 Args: 2410 execution: The execution object. 2411 Returns: 2412 Command line arguments 2413 """ 2414 cargs = [] 2415 cargs.extend([ 2416 "-h", 2417 self.v__help 2418 ]) 2419 return cargs 2420 2421 2422@dataclasses.dataclass 2423class C3dHolefill: 2424 """ 2425 -holefill: Fill holes in binary image 2426 2427 Syntax: `-holefill intensity_value [0|1] ` 2428 2429 Apply the binary hole filling algorithm to a particular intensity value in 2430 the image. The input image is typically a binary image or a multi-label 2431 segmentation image. Holes (voxels not matching the specified intensity value 2432 that are completely contained by voxels matching this value) are filled. The 2433 second parameter specifies what type of topological connectivity is used to 2434 determine holes. The value 0 uses the default algorithm in ITK (face 2435 connectivity) and 1 uses the full connectivity variant (face, edge and 2436 vertex connectivity). For more details see the [ITK page for this 2437 algorithm][7]. 2438 2439 c3d segmentation.nii.gz -holefill 5 0 -type uchar -o filledlabel5.nii.gz. 2440 """ 2441 holefill: str 2442 """-holefill: Fill holes in binary image 2443 2444 Syntax: `-holefill intensity_value [0|1] ` 2445 2446 Apply the binary hole filling algorithm to a particular intensity value in 2447 the image. The input image is typically a binary image or a multi-label 2448 segmentation image. Holes (voxels not matching the specified intensity value 2449 that are completely contained by voxels matching this value) are filled. The 2450 second parameter specifies what type of topological connectivity is used to 2451 determine holes. The value 0 uses the default algorithm in ITK (face 2452 connectivity) and 1 uses the full connectivity variant (face, edge and 2453 vertex connectivity). For more details see the [ITK page for this 2454 algorithm][7]. 2455 2456 c3d segmentation.nii.gz -holefill 5 0 -type uchar -o filledlabel5.nii.gz""" 2457 2458 def run( 2459 self, 2460 execution: Execution, 2461 ) -> list[str]: 2462 """ 2463 Build command line arguments. This method is called by the main command. 2464 2465 Args: 2466 execution: The execution object. 2467 Returns: 2468 Command line arguments 2469 """ 2470 cargs = [] 2471 cargs.extend([ 2472 "-hf", 2473 self.holefill 2474 ]) 2475 return cargs 2476 2477 2478@dataclasses.dataclass 2479class C3dHessianEigenvalues: 2480 """ 2481 -hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix 2482 2483 Syntax `-hesseig <scale>` 2484 2485 Computes the Hessian matrix at every pixel of an image and the eigenvalues 2486 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 2487 the stack. These images are useful as texture features. See also the 2488 '''-steig''' command. The scale determines the amount of Gaussian smoothing 2489 applied for computing the partial derivatives in the Hessian, and is in 2490 physical (mm) units. 2491 2492 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz. 2493 """ 2494 hessian_eigenvalues: str 2495 """-hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix 2496 2497 Syntax `-hesseig <scale>` 2498 2499 Computes the Hessian matrix at every pixel of an image and the eigenvalues 2500 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 2501 the stack. These images are useful as texture features. See also the 2502 '''-steig''' command. The scale determines the amount of Gaussian smoothing 2503 applied for computing the partial derivatives in the Hessian, and is in 2504 physical (mm) units. 2505 2506 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz""" 2507 2508 def run( 2509 self, 2510 execution: Execution, 2511 ) -> list[str]: 2512 """ 2513 Build command line arguments. This method is called by the main command. 2514 2515 Args: 2516 execution: The execution object. 2517 Returns: 2518 Command line arguments 2519 """ 2520 cargs = [] 2521 cargs.extend([ 2522 "-hesseig", 2523 self.hessian_eigenvalues 2524 ]) 2525 return cargs 2526 2527 2528@dataclasses.dataclass 2529class C3dHessianObjectness: 2530 """ 2531 -hessobj, -hessian-objectness: Hessian objectness filter 2532 2533 Syntax: `-hessobj <dimension> <min_scale> <max_scale>` 2534 2535 Also known as the Frangi vesselness filter, this filter can be used to 2536 highlight tube-like, sheet-like and blob-like objects in the image. For 2537 details, see documentation to the [corresponging ITK class][HTOMIF]. 2538 2539 Parameter `dimension` is an integer that determines the kind of features 2540 that are highlighed. Use 0 for blobs, 1 for tubes, 2 for pancakes, etc. The 2541 min and max scale parameters are floating point values, giving the scale of 2542 the features highlighted, in physical units. Typically, just one scale is 2543 used. 2544 2545 # Detect vessel-like structures at scale 0.5mm 2546 c3d image.nii.gz -hessobj 1 0.5 0.5 2547 2548 [HTOMIF] 2549 http://www.itk.org/Doxygen/html/classitk_1_1HessianToObjectnessMeasureImageFilter.html. 2550 """ 2551 hessian_objectness: str 2552 """-hessobj, -hessian-objectness: Hessian objectness filter 2553 2554 Syntax: `-hessobj <dimension> <min_scale> <max_scale>` 2555 2556 Also known as the Frangi vesselness filter, this filter can be used to 2557 highlight tube-like, sheet-like and blob-like objects in the image. For 2558 details, see documentation to the [corresponging ITK class][HTOMIF]. 2559 2560 Parameter `dimension` is an integer that determines the kind of features 2561 that are highlighed. Use 0 for blobs, 1 for tubes, 2 for pancakes, etc. The 2562 min and max scale parameters are floating point values, giving the scale of 2563 the features highlighted, in physical units. Typically, just one scale is 2564 used. 2565 2566 # Detect vessel-like structures at scale 0.5mm 2567 c3d image.nii.gz -hessobj 1 0.5 0.5 2568 2569 [HTOMIF] 2570 http://www.itk.org/Doxygen/html/classitk_1_1HessianToObjectnessMeasureImageFilter.html""" 2571 2572 def run( 2573 self, 2574 execution: Execution, 2575 ) -> list[str]: 2576 """ 2577 Build command line arguments. This method is called by the main command. 2578 2579 Args: 2580 execution: The execution object. 2581 Returns: 2582 Command line arguments 2583 """ 2584 cargs = [] 2585 cargs.extend([ 2586 "-hessobj", 2587 self.hessian_objectness 2588 ]) 2589 return cargs 2590 2591 2592@dataclasses.dataclass 2593class C3dHistogramMatch: 2594 """ 2595 No description found. 2596 """ 2597 histogram_match: str 2598 """No description found.""" 2599 2600 def run( 2601 self, 2602 execution: Execution, 2603 ) -> list[str]: 2604 """ 2605 Build command line arguments. This method is called by the main command. 2606 2607 Args: 2608 execution: The execution object. 2609 Returns: 2610 Command line arguments 2611 """ 2612 cargs = [] 2613 cargs.extend([ 2614 "-histmatch", 2615 self.histogram_match 2616 ]) 2617 return cargs 2618 2619 2620@dataclasses.dataclass 2621class C3dInfo: 2622 """ 2623 -info: Display brief image information 2624 2625 Syntax: `-info` 2626 2627 Prints brief information about the last image on the stack. Does not affect 2628 the stack. 2629 2630 c3d image.hdr -info 2631 2632 Use with the **-foreach** command to get information on multiple images 2633 2634 c3d images*.nii -foreach -info -endfor. 2635 """ 2636 info: str 2637 """-info: Display brief image information 2638 2639 Syntax: `-info` 2640 2641 Prints brief information about the last image on the stack. Does not affect 2642 the stack. 2643 2644 c3d image.hdr -info 2645 2646 Use with the **-foreach** command to get information on multiple images 2647 2648 c3d images*.nii -foreach -info -endfor""" 2649 2650 def run( 2651 self, 2652 execution: Execution, 2653 ) -> list[str]: 2654 """ 2655 Build command line arguments. This method is called by the main command. 2656 2657 Args: 2658 execution: The execution object. 2659 Returns: 2660 Command line arguments 2661 """ 2662 cargs = [] 2663 cargs.extend([ 2664 "-info", 2665 self.info 2666 ]) 2667 return cargs 2668 2669 2670@dataclasses.dataclass 2671class C3dInfoFull: 2672 """ 2673 -info-full: Display verbose image information 2674 2675 Syntax: `-info-full` 2676 2677 Prints extended information about the last image on the stack, such as the 2678 metadata dictionary. For example, 2679 2680 c3d image.hdr -info-full. 2681 """ 2682 info_full: str 2683 """-info-full: Display verbose image information 2684 2685 Syntax: `-info-full` 2686 2687 Prints extended information about the last image on the stack, such as the 2688 metadata dictionary. For example, 2689 2690 c3d image.hdr -info-full""" 2691 2692 def run( 2693 self, 2694 execution: Execution, 2695 ) -> list[str]: 2696 """ 2697 Build command line arguments. This method is called by the main command. 2698 2699 Args: 2700 execution: The execution object. 2701 Returns: 2702 Command line arguments 2703 """ 2704 cargs = [] 2705 cargs.extend([ 2706 "-info-full", 2707 self.info_full 2708 ]) 2709 return cargs 2710 2711 2712@dataclasses.dataclass 2713class C3dInsert: 2714 """ 2715 -insert: Insert image anywhere in the stack 2716 2717 Syntax: `-insert var pos` 2718 2719 This command is similar to **-push**, but allows you to insert the image 2720 associated with 'var' at any position in the stack, counting from the end. 2721 When 'pos' is 0, the image is placed at the end of the stack (same as 2722 **-push**). When pos is one, the image is placed at the next-to-end 2723 position, and so on. 2724 """ 2725 insert: str 2726 """-insert: Insert image anywhere in the stack 2727 2728 Syntax: `-insert var pos` 2729 2730 This command is similar to **-push**, but allows you to insert the image 2731 associated with 'var' at any position in the stack, counting from the end. 2732 When 'pos' is 0, the image is placed at the end of the stack (same as 2733 **-push**). When pos is one, the image is placed at the next-to-end 2734 position, and so on.""" 2735 2736 def run( 2737 self, 2738 execution: Execution, 2739 ) -> list[str]: 2740 """ 2741 Build command line arguments. This method is called by the main command. 2742 2743 Args: 2744 execution: The execution object. 2745 Returns: 2746 Command line arguments 2747 """ 2748 cargs = [] 2749 cargs.extend([ 2750 "-insert", 2751 self.insert 2752 ]) 2753 return cargs 2754 2755 2756@dataclasses.dataclass 2757class C3dInterpolation: 2758 """ 2759 -interpolation: Set interpolation mode 2760 2761 Syntax: `-interpolation <NearestNeighbor|Linear|Cubic|Sinc|Gaussian> 2762 [param]` 2763 2764 Specifies the interpolation used with **-resample** and other commands. 2765 Default is **Linear**. Gaussian interpolation takes as the parameter the 2766 standard deviation of the Gaussian filter (e.g, 1mm). Gaussian interpolation 2767 is very similar in result to first smoothing an image with a Gaussian filter 2768 and then reslicing it with linear interpolation, but is more accurate and 2769 has less aliasing artifacts. It is also slower, and should only be used with 2770 small sigmas (a few voxels across). 2771 2772 Shorthand 0 can be used for *NearestNeighbor*, 1 for *Linear* and 3 for 2773 *Cubic*. For example: 2774 2775 c3d -int 3 test.nii -resample 200x200x200% -o cubic_supersample.nii. 2776 """ 2777 interpolation: str 2778 """-interpolation: Set interpolation mode 2779 2780 Syntax: `-interpolation <NearestNeighbor|Linear|Cubic|Sinc|Gaussian> 2781 [param]` 2782 2783 Specifies the interpolation used with **-resample** and other commands. 2784 Default is **Linear**. Gaussian interpolation takes as the parameter the 2785 standard deviation of the Gaussian filter (e.g, 1mm). Gaussian interpolation 2786 is very similar in result to first smoothing an image with a Gaussian filter 2787 and then reslicing it with linear interpolation, but is more accurate and 2788 has less aliasing artifacts. It is also slower, and should only be used with 2789 small sigmas (a few voxels across). 2790 2791 Shorthand 0 can be used for *NearestNeighbor*, 1 for *Linear* and 3 for 2792 *Cubic*. For example: 2793 2794 c3d -int 3 test.nii -resample 200x200x200% -o cubic_supersample.nii""" 2795 2796 def run( 2797 self, 2798 execution: Execution, 2799 ) -> list[str]: 2800 """ 2801 Build command line arguments. This method is called by the main command. 2802 2803 Args: 2804 execution: The execution object. 2805 Returns: 2806 Command line arguments 2807 """ 2808 cargs = [] 2809 cargs.extend([ 2810 "-interpolation", 2811 self.interpolation 2812 ]) 2813 return cargs 2814 2815 2816@dataclasses.dataclass 2817class C3dIterations: 2818 """ 2819 No description found. 2820 """ 2821 iterations: str 2822 """No description found.""" 2823 2824 def run( 2825 self, 2826 execution: Execution, 2827 ) -> list[str]: 2828 """ 2829 Build command line arguments. This method is called by the main command. 2830 2831 Args: 2832 execution: The execution object. 2833 Returns: 2834 Command line arguments 2835 """ 2836 cargs = [] 2837 cargs.extend([ 2838 "-iterations", 2839 self.iterations 2840 ]) 2841 return cargs 2842 2843 2844@dataclasses.dataclass 2845class C3dLabelOverlap: 2846 """ 2847 No description found. 2848 """ 2849 label_overlap: str 2850 """No description found.""" 2851 2852 def run( 2853 self, 2854 execution: Execution, 2855 ) -> list[str]: 2856 """ 2857 Build command line arguments. This method is called by the main command. 2858 2859 Args: 2860 execution: The execution object. 2861 Returns: 2862 Command line arguments 2863 """ 2864 cargs = [] 2865 cargs.extend([ 2866 "-label-overlap", 2867 self.label_overlap 2868 ]) 2869 return cargs 2870 2871 2872@dataclasses.dataclass 2873class C3dLabelStatistics: 2874 """ 2875 -lstat, -label-statistics: Display segmentation volumes and intensity 2876 statistics 2877 2878 Syntax: `-lstat` 2879 2880 Given a grayscale image and a multilabel (or binary) image, this command 2881 computes the statistics for every label in the latter, including volumes, 2882 average grayscale intensity, etc. For instance, if image *mri.nii* is a 2883 medical image and *seg.nii* is a multilabel segmentation of the image with 2884 labels 0, 1 and 4, the following command can be used to print the statistics 2885 of the intensity of *mri.nii* for each of the labels 2886 2887 c3d mri.nii seg.nii -lstat 2888 2889 The output contains the mean, standard deviation, maximum intensity and 2890 minimum intensity for each label. If you just need volumes from a 2891 multi-label image, use **-dup** command as follows: 2892 2893 c3d seg.nii -dup -lstat. 2894 """ 2895 label_statistics: str 2896 """-lstat, -label-statistics: Display segmentation volumes and intensity 2897 statistics 2898 2899 Syntax: `-lstat` 2900 2901 Given a grayscale image and a multilabel (or binary) image, this command 2902 computes the statistics for every label in the latter, including volumes, 2903 average grayscale intensity, etc. For instance, if image *mri.nii* is a 2904 medical image and *seg.nii* is a multilabel segmentation of the image with 2905 labels 0, 1 and 4, the following command can be used to print the statistics 2906 of the intensity of *mri.nii* for each of the labels 2907 2908 c3d mri.nii seg.nii -lstat 2909 2910 The output contains the mean, standard deviation, maximum intensity and 2911 minimum intensity for each label. If you just need volumes from a 2912 multi-label image, use **-dup** command as follows: 2913 2914 c3d seg.nii -dup -lstat""" 2915 2916 def run( 2917 self, 2918 execution: Execution, 2919 ) -> list[str]: 2920 """ 2921 Build command line arguments. This method is called by the main command. 2922 2923 Args: 2924 execution: The execution object. 2925 Returns: 2926 Command line arguments 2927 """ 2928 cargs = [] 2929 cargs.extend([ 2930 "-label-statistics", 2931 self.label_statistics 2932 ]) 2933 return cargs 2934 2935 2936@dataclasses.dataclass 2937class C3dLandmarksToSpheres: 2938 """ 2939 No description found. 2940 """ 2941 landmarks_to_spheres: str 2942 """No description found.""" 2943 2944 def run( 2945 self, 2946 execution: Execution, 2947 ) -> list[str]: 2948 """ 2949 Build command line arguments. This method is called by the main command. 2950 2951 Args: 2952 execution: The execution object. 2953 Returns: 2954 Command line arguments 2955 """ 2956 cargs = [] 2957 cargs.extend([ 2958 "-landmarks-to-spheres", 2959 self.landmarks_to_spheres 2960 ]) 2961 return cargs 2962 2963 2964@dataclasses.dataclass 2965class C3dLaplacian: 2966 """ 2967 -laplacian, -laplace: Laplacian filter 2968 2969 Syntax: `-laplacian` 2970 2971 Applies the Laplacian filter to the image. Used to detect ridges of 2972 intensity. Typically, used with the **-smooth** option to obtain the 2973 equivalent of convolving the image with the *Laplacian of the Gaussian 2974 (LoG)* kernel: 2975 2976 c3d input.img -smooth 1.2vox -laplacian -o output.img. 2977 """ 2978 laplacian: str 2979 """-laplacian, -laplace: Laplacian filter 2980 2981 Syntax: `-laplacian` 2982 2983 Applies the Laplacian filter to the image. Used to detect ridges of 2984 intensity. Typically, used with the **-smooth** option to obtain the 2985 equivalent of convolving the image with the *Laplacian of the Gaussian 2986 (LoG)* kernel: 2987 2988 c3d input.img -smooth 1.2vox -laplacian -o output.img""" 2989 2990 def run( 2991 self, 2992 execution: Execution, 2993 ) -> list[str]: 2994 """ 2995 Build command line arguments. This method is called by the main command. 2996 2997 Args: 2998 execution: The execution object. 2999 Returns: 3000 Command line arguments 3001 """ 3002 cargs = [] 3003 cargs.extend([ 3004 "-laplacian", 3005 self.laplacian 3006 ]) 3007 return cargs 3008 3009 3010@dataclasses.dataclass 3011class C3dLevelset: 3012 """ 3013 -levelset: Level set segmentation 3014 3015 Syntax: `-levelset n_iter ` 3016 3017 Perform level set segmentation for *n\_iter* iterations, like in ITK-SNAP. 3018 The last image on the stack is treated as the initialization image and the 3019 next-to-last image on the stack is the speed image. Both images should be in 3020 the range between -1 and 1. Here is how the signs of the different images 3021 are interpreted 3022 3023 | | Speed Image | Initialization Image | Output Image | 3024 | -- | ------------- | -------------------- | ------------ | 3025 | +1 | Foreground | Outside | Outside | 3026 | -1 | Background | Inside | Inside | 3027 3028 Here is an example where you have the speed and the initialization given: 3029 3030 c3d speed.img initial.img -levelset-curvature 0.5 -levelset 100 -o seg.img 3031 3032 Here is an example of segmenting the ventricles in an MRI image, where the 3033 ventricles and other CSF have intensity below 715. The image 3034 seg_bubbles.nii.gz in this example is a binary image of the initialization 3035 seeds (1 inside the seeds, 0 outside). 3036 3037 c3d brain.nii.gz -erf 715 100 -scale -1 seg_bubbles.nii.gz \ 3038 -replace 0 1 1 -1 -levelset-curvature 0.2 -levelset 500 \ 3039 -thresh -inf 0 1 0 -o segmentation.nii.gz 3040 3041 Another example of smoothing a binary image that is useful for cleaning up 3042 manual segmentations. Here the speed image is positive inside the binary 3043 object, and the initialization is negative inside the object. The command 3044 writes out both the level set image (whose 0-level set is the smoothed 3045 boundary of the binary object) and the smoothed binary object 3046 3047 c3d binary.img -threshold 1 inf 1 -1 -binary.img 1 inf 1 -1 \ 3048 -levelset-curvature 1.5 -levelset 100 -o levelset.img \ 3049 -thresh -inf 0 1 0 -o smoothed_binary.img. 3050 """ 3051 levelset: str 3052 """-levelset: Level set segmentation 3053 3054 Syntax: `-levelset n_iter ` 3055 3056 Perform level set segmentation for *n\_iter* iterations, like in ITK-SNAP. 3057 The last image on the stack is treated as the initialization image and the 3058 next-to-last image on the stack is the speed image. Both images should be in 3059 the range between -1 and 1. Here is how the signs of the different images 3060 are interpreted 3061 3062 | | Speed Image | Initialization Image | Output Image | 3063 | -- | ------------- | -------------------- | ------------ | 3064 | +1 | Foreground | Outside | Outside | 3065 | -1 | Background | Inside | Inside | 3066 3067 Here is an example where you have the speed and the initialization given: 3068 3069 c3d speed.img initial.img -levelset-curvature 0.5 -levelset 100 -o seg.img 3070 3071 Here is an example of segmenting the ventricles in an MRI image, where the 3072 ventricles and other CSF have intensity below 715. The image 3073 seg_bubbles.nii.gz in this example is a binary image of the initialization 3074 seeds (1 inside the seeds, 0 outside). 3075 3076 c3d brain.nii.gz -erf 715 100 -scale -1 seg_bubbles.nii.gz \ 3077 -replace 0 1 1 -1 -levelset-curvature 0.2 -levelset 500 \ 3078 -thresh -inf 0 1 0 -o segmentation.nii.gz 3079 3080 Another example of smoothing a binary image that is useful for cleaning up 3081 manual segmentations. Here the speed image is positive inside the binary 3082 object, and the initialization is negative inside the object. The command 3083 writes out both the level set image (whose 0-level set is the smoothed 3084 boundary of the binary object) and the smoothed binary object 3085 3086 c3d binary.img -threshold 1 inf 1 -1 -binary.img 1 inf 1 -1 \ 3087 -levelset-curvature 1.5 -levelset 100 -o levelset.img \ 3088 -thresh -inf 0 1 0 -o smoothed_binary.img""" 3089 3090 def run( 3091 self, 3092 execution: Execution, 3093 ) -> list[str]: 3094 """ 3095 Build command line arguments. This method is called by the main command. 3096 3097 Args: 3098 execution: The execution object. 3099 Returns: 3100 Command line arguments 3101 """ 3102 cargs = [] 3103 cargs.extend([ 3104 "-levelset", 3105 self.levelset 3106 ]) 3107 return cargs 3108 3109 3110@dataclasses.dataclass 3111class C3dLevelsetCurvature: 3112 """ 3113 No description found. 3114 """ 3115 levelset_curvature: str 3116 """No description found.""" 3117 3118 def run( 3119 self, 3120 execution: Execution, 3121 ) -> list[str]: 3122 """ 3123 Build command line arguments. This method is called by the main command. 3124 3125 Args: 3126 execution: The execution object. 3127 Returns: 3128 Command line arguments 3129 """ 3130 cargs = [] 3131 cargs.extend([ 3132 "-levelset-curvature", 3133 self.levelset_curvature 3134 ]) 3135 return cargs 3136 3137 3138@dataclasses.dataclass 3139class C3dLevelsetAdvection: 3140 """ 3141 No description found. 3142 """ 3143 levelset_advection: str 3144 """No description found.""" 3145 3146 def run( 3147 self, 3148 execution: Execution, 3149 ) -> list[str]: 3150 """ 3151 Build command line arguments. This method is called by the main command. 3152 3153 Args: 3154 execution: The execution object. 3155 Returns: 3156 Command line arguments 3157 """ 3158 cargs = [] 3159 cargs.extend([ 3160 "-levelset-advection", 3161 self.levelset_advection 3162 ]) 3163 return cargs 3164 3165 3166@dataclasses.dataclass 3167class C3dLog: 3168 """ 3169 -log, -ln: Voxelwise natural logarithm 3170 3171 Syntax: `-log` 3172 3173 Computes natural logarithm of each voxel in the last image on the stack. 3174 """ 3175 log: str 3176 """-log, -ln: Voxelwise natural logarithm 3177 3178 Syntax: `-log` 3179 3180 Computes natural logarithm of each voxel in the last image on the stack.""" 3181 3182 def run( 3183 self, 3184 execution: Execution, 3185 ) -> list[str]: 3186 """ 3187 Build command line arguments. This method is called by the main command. 3188 3189 Args: 3190 execution: The execution object. 3191 Returns: 3192 Command line arguments 3193 """ 3194 cargs = [] 3195 cargs.extend([ 3196 "-ln", 3197 self.log 3198 ]) 3199 return cargs 3200 3201 3202@dataclasses.dataclass 3203class C3dLog10: 3204 """ 3205 -log10: Voxelwise base 10 logarithm 3206 3207 Syntax: `-log10` 3208 3209 Computes base 10 logarithm of each voxel in the last image on the stack. 3210 """ 3211 log10: str 3212 """-log10: Voxelwise base 10 logarithm 3213 3214 Syntax: `-log10` 3215 3216 Computes base 10 logarithm of each voxel in the last image on the stack.""" 3217 3218 def run( 3219 self, 3220 execution: Execution, 3221 ) -> list[str]: 3222 """ 3223 Build command line arguments. This method is called by the main command. 3224 3225 Args: 3226 execution: The execution object. 3227 Returns: 3228 Command line arguments 3229 """ 3230 cargs = [] 3231 cargs.extend([ 3232 "-log10", 3233 self.log10 3234 ]) 3235 return cargs 3236 3237 3238@dataclasses.dataclass 3239class C3dManual: 3240 """ 3241 No description found. 3242 """ 3243 manual: str 3244 """No description found.""" 3245 3246 def run( 3247 self, 3248 execution: Execution, 3249 ) -> list[str]: 3250 """ 3251 Build command line arguments. This method is called by the main command. 3252 3253 Args: 3254 execution: The execution object. 3255 Returns: 3256 Command line arguments 3257 """ 3258 cargs = [] 3259 cargs.extend([ 3260 "-manual", 3261 self.manual 3262 ]) 3263 return cargs 3264 3265 3266@dataclasses.dataclass 3267class C3dMatchBoundingBox: 3268 """ 3269 -mbb, -match-bounding-box: Match bounding box of one image to another 3270 3271 Syntax: `-mbb` 3272 3273 Given two images on the stack (reference and target), sets the header of the 3274 target image so that the two images occupy the same physical space. The 3275 direction cosines of the target image are set to match the reference image. 3276 This command is related to '-copy-transform' but supports images of 3277 different size. 3278 3279 c3d reference.nii target.nii -mbb -o out.nii. 3280 """ 3281 match_bounding_box: str 3282 """-mbb, -match-bounding-box: Match bounding box of one image to another 3283 3284 Syntax: `-mbb` 3285 3286 Given two images on the stack (reference and target), sets the header of the 3287 target image so that the two images occupy the same physical space. The 3288 direction cosines of the target image are set to match the reference image. 3289 This command is related to '-copy-transform' but supports images of 3290 different size. 3291 3292 c3d reference.nii target.nii -mbb -o out.nii""" 3293 3294 def run( 3295 self, 3296 execution: Execution, 3297 ) -> list[str]: 3298 """ 3299 Build command line arguments. This method is called by the main command. 3300 3301 Args: 3302 execution: The execution object. 3303 Returns: 3304 Command line arguments 3305 """ 3306 cargs = [] 3307 cargs.extend([ 3308 "-match-bounding-box", 3309 self.match_bounding_box 3310 ]) 3311 return cargs 3312 3313 3314@dataclasses.dataclass 3315class C3dMaximum: 3316 """ 3317 -max: Voxel-wise maximum of two images 3318 3319 Syntax: `-max` 3320 3321 Computes the voxel-wise maximum of two images. Can be used with the 3322 **-accum** command to compute maximum of all images. 3323 3324 c3d i1.nii i2.nii -max -o max12.nii 3325 c3d i1.nii i2.nii i3.nii i4.nii -accum -max -endaccum -o max1234.nii. 3326 """ 3327 maximum: str 3328 """-max: Voxel-wise maximum of two images 3329 3330 Syntax: `-max` 3331 3332 Computes the voxel-wise maximum of two images. Can be used with the 3333 **-accum** command to compute maximum of all images. 3334 3335 c3d i1.nii i2.nii -max -o max12.nii 3336 c3d i1.nii i2.nii i3.nii i4.nii -accum -max -endaccum -o max1234.nii""" 3337 3338 def run( 3339 self, 3340 execution: Execution, 3341 ) -> list[str]: 3342 """ 3343 Build command line arguments. This method is called by the main command. 3344 3345 Args: 3346 execution: The execution object. 3347 Returns: 3348 Command line arguments 3349 """ 3350 cargs = [] 3351 cargs.extend([ 3352 "-maximum", 3353 self.maximum 3354 ]) 3355 return cargs 3356 3357 3358@dataclasses.dataclass 3359class C3dMulticomponentSplit: 3360 """ 3361 -mcs, -multicomponent-split: Enable splitting of multi-component images on 3362 read 3363 3364 Syntax: `-mcs` 3365 3366 Enable reading of multi-component images. By default, when a multi-component 3367 image is encountered, the components are combined into a single image. 3368 Setting the **-mcs** flag changes this behavior, and each of the components 3369 is loaded sequentially. See the section below on multi-component image 3370 support. 3371 3372 $ c3d -mcs rgb.mha -foreach -probe 110x110x80mm -endfor 3373 Interpolated image value at 110 110 80 is 1 3374 Interpolated image value at 110 110 80 is 66 3375 Interpolated image value at 110 110 80 is 29 3376 3377 $ c3d rgb.mha -foreach -probe 110x110x80mm -endfor 3378 Interpolated image value at 110 110 80 is 49.5198. 3379 """ 3380 multicomponent_split: str 3381 """-mcs, -multicomponent-split: Enable splitting of multi-component images 3382 on read 3383 3384 Syntax: `-mcs` 3385 3386 Enable reading of multi-component images. By default, when a multi-component 3387 image is encountered, the components are combined into a single image. 3388 Setting the **-mcs** flag changes this behavior, and each of the components 3389 is loaded sequentially. See the section below on multi-component image 3390 support. 3391 3392 $ c3d -mcs rgb.mha -foreach -probe 110x110x80mm -endfor 3393 Interpolated image value at 110 110 80 is 1 3394 Interpolated image value at 110 110 80 is 66 3395 Interpolated image value at 110 110 80 is 29 3396 3397 $ c3d rgb.mha -foreach -probe 110x110x80mm -endfor 3398 Interpolated image value at 110 110 80 is 49.5198""" 3399 3400 def run( 3401 self, 3402 execution: Execution, 3403 ) -> list[str]: 3404 """ 3405 Build command line arguments. This method is called by the main command. 3406 3407 Args: 3408 execution: The execution object. 3409 Returns: 3410 Command line arguments 3411 """ 3412 cargs = [] 3413 cargs.extend([ 3414 "-mcs", 3415 self.multicomponent_split 3416 ]) 3417 return cargs 3418 3419 3420@dataclasses.dataclass 3421class C3dMean: 3422 """ 3423 -mean: Mean of all images on the stack 3424 3425 Syntax: `-mean ` 3426 3427 Computes the mean of all the images on the stack. All images on the stack 3428 are replaced with the mean image. 3429 3430 c3d image_*.nii -mean -o mean.nii. 3431 """ 3432 mean: str 3433 """-mean: Mean of all images on the stack 3434 3435 Syntax: `-mean ` 3436 3437 Computes the mean of all the images on the stack. All images on the stack 3438 are replaced with the mean image. 3439 3440 c3d image_*.nii -mean -o mean.nii""" 3441 3442 def run( 3443 self, 3444 execution: Execution, 3445 ) -> list[str]: 3446 """ 3447 Build command line arguments. This method is called by the main command. 3448 3449 Args: 3450 execution: The execution object. 3451 Returns: 3452 Command line arguments 3453 """ 3454 cargs = [] 3455 cargs.extend([ 3456 "-mean", 3457 self.mean 3458 ]) 3459 return cargs 3460 3461 3462@dataclasses.dataclass 3463class C3dMedianFilter: 3464 """ 3465 -median, -median-filter: Median filter 3466 3467 Syntax: `-median <radius_vector>` 3468 3469 Applies the median filter: the intensity of each voxel is replaced by the 3470 median of the intensities in the neighborhood of size specified by the 3471 radius parameter. For example, the following code will apply the median 3472 filter with the 5x5x5 neighborhood. 3473 3474 c3d in.nii -median 2x2x2 -o median.nii. 3475 """ 3476 median_filter: str 3477 """-median, -median-filter: Median filter 3478 3479 Syntax: `-median <radius_vector>` 3480 3481 Applies the median filter: the intensity of each voxel is replaced by the 3482 median of the intensities in the neighborhood of size specified by the 3483 radius parameter. For example, the following code will apply the median 3484 filter with the 5x5x5 neighborhood. 3485 3486 c3d in.nii -median 2x2x2 -o median.nii""" 3487 3488 def run( 3489 self, 3490 execution: Execution, 3491 ) -> list[str]: 3492 """ 3493 Build command line arguments. This method is called by the main command. 3494 3495 Args: 3496 execution: The execution object. 3497 Returns: 3498 Command line arguments 3499 """ 3500 cargs = [] 3501 cargs.extend([ 3502 "-median", 3503 self.median_filter 3504 ]) 3505 return cargs 3506 3507 3508@dataclasses.dataclass 3509class C3dMerge: 3510 """ 3511 -merge: Merge images from previous split command 3512 3513 Syntax: `-merge` 3514 3515 Works in conjunction with the **-split** command. Has similar behavior to 3516 **-vote**, except that label values are carried from the input to the 3517 **-split** command. 3518 """ 3519 merge: str 3520 """-merge: Merge images from previous split command 3521 3522 Syntax: `-merge` 3523 3524 Works in conjunction with the **-split** command. Has similar behavior to 3525 **-vote**, except that label values are carried from the input to the 3526 **-split** command.""" 3527 3528 def run( 3529 self, 3530 execution: Execution, 3531 ) -> list[str]: 3532 """ 3533 Build command line arguments. This method is called by the main command. 3534 3535 Args: 3536 execution: The execution object. 3537 Returns: 3538 Command line arguments 3539 """ 3540 cargs = [] 3541 cargs.extend([ 3542 "-merge", 3543 self.merge 3544 ]) 3545 return cargs 3546 3547 3548@dataclasses.dataclass 3549class C3dMeanFilter: 3550 """ 3551 -mf, -mean-filter: Mean filter 3552 3553 Syntax: `-mf <radius_vector>` 3554 3555 Applies the mean filter: the intensity of each voxel is replaced by the mean 3556 of the intensities in the neighborhood of size specified by the radius 3557 parameter. For example, the following code will apply the mean filter with 3558 the 5x5x5 neighborhood. 3559 3560 c3d in.nii -mf 2x2x2 -o filtered.nii. 3561 """ 3562 mean_filter: str 3563 """-mf, -mean-filter: Mean filter 3564 3565 Syntax: `-mf <radius_vector>` 3566 3567 Applies the mean filter: the intensity of each voxel is replaced by the mean 3568 of the intensities in the neighborhood of size specified by the radius 3569 parameter. For example, the following code will apply the mean filter with 3570 the 5x5x5 neighborhood. 3571 3572 c3d in.nii -mf 2x2x2 -o filtered.nii""" 3573 3574 def run( 3575 self, 3576 execution: Execution, 3577 ) -> list[str]: 3578 """ 3579 Build command line arguments. This method is called by the main command. 3580 3581 Args: 3582 execution: The execution object. 3583 Returns: 3584 Command line arguments 3585 """ 3586 cargs = [] 3587 cargs.extend([ 3588 "-mf", 3589 self.mean_filter 3590 ]) 3591 return cargs 3592 3593 3594@dataclasses.dataclass 3595class C3dMutualInfo: 3596 """ 3597 -min: Voxel-wise minimum of two images 3598 3599 Syntax: `-min` 3600 3601 Computes the voxel-wise minimum of two images. Can be used with the 3602 **-accum** command to compute minimum of all images. 3603 3604 c3d i1.nii i2.nii -min -o min12.nii 3605 c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii. 3606 """ 3607 mutual_info: str 3608 """-min: Voxel-wise minimum of two images 3609 3610 Syntax: `-min` 3611 3612 Computes the voxel-wise minimum of two images. Can be used with the 3613 **-accum** command to compute minimum of all images. 3614 3615 c3d i1.nii i2.nii -min -o min12.nii 3616 c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii""" 3617 3618 def run( 3619 self, 3620 execution: Execution, 3621 ) -> list[str]: 3622 """ 3623 Build command line arguments. This method is called by the main command. 3624 3625 Args: 3626 execution: The execution object. 3627 Returns: 3628 Command line arguments 3629 """ 3630 cargs = [] 3631 cargs.extend([ 3632 "-mi", 3633 self.mutual_info 3634 ]) 3635 return cargs 3636 3637 3638@dataclasses.dataclass 3639class C3dMinimum: 3640 """ 3641 -min: Voxel-wise minimum of two images 3642 3643 Syntax: `-min` 3644 3645 Computes the voxel-wise minimum of two images. Can be used with the 3646 **-accum** command to compute minimum of all images. 3647 3648 c3d i1.nii i2.nii -min -o min12.nii 3649 c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii. 3650 """ 3651 minimum: str 3652 """-min: Voxel-wise minimum of two images 3653 3654 Syntax: `-min` 3655 3656 Computes the voxel-wise minimum of two images. Can be used with the 3657 **-accum** command to compute minimum of all images. 3658 3659 c3d i1.nii i2.nii -min -o min12.nii 3660 c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii""" 3661 3662 def run( 3663 self, 3664 execution: Execution, 3665 ) -> list[str]: 3666 """ 3667 Build command line arguments. This method is called by the main command. 3668 3669 Args: 3670 execution: The execution object. 3671 Returns: 3672 Command line arguments 3673 """ 3674 cargs = [] 3675 cargs.extend([ 3676 "-minimum", 3677 self.minimum 3678 ]) 3679 return cargs 3680 3681 3682@dataclasses.dataclass 3683class C3dMixtureModel: 3684 """ 3685 No description found. 3686 """ 3687 mixture_model: str 3688 """No description found.""" 3689 3690 def run( 3691 self, 3692 execution: Execution, 3693 ) -> list[str]: 3694 """ 3695 Build command line arguments. This method is called by the main command. 3696 3697 Args: 3698 execution: The execution object. 3699 Returns: 3700 Command line arguments 3701 """ 3702 cargs = [] 3703 cargs.extend([ 3704 "-mixture", 3705 self.mixture_model 3706 ]) 3707 return cargs 3708 3709 3710@dataclasses.dataclass 3711class C3dMoments: 3712 """ 3713 No description found. 3714 """ 3715 moments: str 3716 """No description found.""" 3717 3718 def run( 3719 self, 3720 execution: Execution, 3721 ) -> list[str]: 3722 """ 3723 Build command line arguments. This method is called by the main command. 3724 3725 Args: 3726 execution: The execution object. 3727 Returns: 3728 Command line arguments 3729 """ 3730 cargs = [] 3731 cargs.extend([ 3732 "-moments", 3733 self.moments 3734 ]) 3735 return cargs 3736 3737 3738@dataclasses.dataclass 3739class C3dMattesMutualInfo: 3740 """ 3741 No description found. 3742 """ 3743 mattes_mutual_info: str 3744 """No description found.""" 3745 3746 def run( 3747 self, 3748 execution: Execution, 3749 ) -> list[str]: 3750 """ 3751 Build command line arguments. This method is called by the main command. 3752 3753 Args: 3754 execution: The execution object. 3755 Returns: 3756 Command line arguments 3757 """ 3758 cargs = [] 3759 cargs.extend([ 3760 "-mmi", 3761 self.mattes_mutual_info 3762 ]) 3763 return cargs 3764 3765 3766@dataclasses.dataclass 3767class C3dMeanSquare: 3768 """ 3769 -msq, -mean-square: Compute mean square difference metric 3770 3771 Syntax: `-msq [movtransform.mat] [reftransform.mat]` 3772 3773 Compute the mean square difference metric between the last two images on the 3774 stack. If an optional *movtransform.mat* file is provided, the metric is 3775 computed by applying the transform to the moving image. If, in addition to 3776 *movtransform.mat*, the optional *reftransform.mat* file is also provided -- 3777 the moving transform is applied to the moving image, the ref transform is 3778 applied to the reference image, and the metric is computed in an image space 3779 that is physically halfway between the reference and moving images. This may 3780 be useful for unbiased metric computation if the two transforms are inverse 3781 of each other as both images undergo similar amount of interpolation. The 3782 definitions of reference and moving images and the transform file format are 3783 similar to the **-reslice-matrix** command. 3784 3785 # Compute metric between ref.nii and mov.nii 3786 c3d ref.nii mov.nii -msq 3787 3788 # Compute metric between ref.nii and mov.nii after applying transform to 3789 mov.nii 3790 c3d ref.nii mov.nii -msq tmov.mat 3791 3792 # Compute metric between ref.nii and mov.nii in a neutral space after 3793 applying transforms to both 3794 c3d ref.nii mov.nii -msq tmov.mat tref.mat. 3795 """ 3796 mean_square: str 3797 """-msq, -mean-square: Compute mean square difference metric 3798 3799 Syntax: `-msq [movtransform.mat] [reftransform.mat]` 3800 3801 Compute the mean square difference metric between the last two images on the 3802 stack. If an optional *movtransform.mat* file is provided, the metric is 3803 computed by applying the transform to the moving image. If, in addition to 3804 *movtransform.mat*, the optional *reftransform.mat* file is also provided -- 3805 the moving transform is applied to the moving image, the ref transform is 3806 applied to the reference image, and the metric is computed in an image space 3807 that is physically halfway between the reference and moving images. This may 3808 be useful for unbiased metric computation if the two transforms are inverse 3809 of each other as both images undergo similar amount of interpolation. The 3810 definitions of reference and moving images and the transform file format are 3811 similar to the **-reslice-matrix** command. 3812 3813 # Compute metric between ref.nii and mov.nii 3814 c3d ref.nii mov.nii -msq 3815 3816 # Compute metric between ref.nii and mov.nii after applying transform to 3817 mov.nii 3818 c3d ref.nii mov.nii -msq tmov.mat 3819 3820 # Compute metric between ref.nii and mov.nii in a neutral space after 3821 applying transforms to both 3822 c3d ref.nii mov.nii -msq tmov.mat tref.mat""" 3823 3824 def run( 3825 self, 3826 execution: Execution, 3827 ) -> list[str]: 3828 """ 3829 Build command line arguments. This method is called by the main command. 3830 3831 Args: 3832 execution: The execution object. 3833 Returns: 3834 Command line arguments 3835 """ 3836 cargs = [] 3837 cargs.extend([ 3838 "-msq", 3839 self.mean_square 3840 ]) 3841 return cargs 3842 3843 3844@dataclasses.dataclass 3845class C3dMultiply: 3846 """ 3847 -multiply, -times: Multiply two images 3848 3849 Syntax: `-multiply` 3850 3851 Multiply two images voxel-by-voxel. The operation is applied to the last two 3852 images on the stack. 3853 3854 # Compute x = a * b 3855 c3d a.img b.img -multiply -o x.img 3856 3857 # Compute x = a * (b + c) using add and -multiply 3858 c3d a.img b.img c.img -multiply -add -o x.img 3859 3860 Combine with the **-dup** command to compute voxelwise square of the image 3861 3862 # Compute x = a^2 3863 c3d a.img -dup -multiply -o x.img. 3864 """ 3865 multiply: str 3866 """-multiply, -times: Multiply two images 3867 3868 Syntax: `-multiply` 3869 3870 Multiply two images voxel-by-voxel. The operation is applied to the last two 3871 images on the stack. 3872 3873 # Compute x = a * b 3874 c3d a.img b.img -multiply -o x.img 3875 3876 # Compute x = a * (b + c) using add and -multiply 3877 c3d a.img b.img c.img -multiply -add -o x.img 3878 3879 Combine with the **-dup** command to compute voxelwise square of the image 3880 3881 # Compute x = a^2 3882 c3d a.img -dup -multiply -o x.img""" 3883 3884 def run( 3885 self, 3886 execution: Execution, 3887 ) -> list[str]: 3888 """ 3889 Build command line arguments. This method is called by the main command. 3890 3891 Args: 3892 execution: The execution object. 3893 Returns: 3894 Command line arguments 3895 """ 3896 cargs = [] 3897 cargs.extend([ 3898 "-multiply", 3899 self.multiply 3900 ]) 3901 return cargs 3902 3903 3904@dataclasses.dataclass 3905class C3dNormalizedCrossCorrelation: 3906 """ 3907 -ncc, -normalized-cross-correlation: Compute normalized cross-correlation 3908 image 3909 3910 Syntax: `-ncc <radius_vector>` 3911 3912 Computes normalized cross-correlation between two images that occupy the 3913 same physical space. Each voxel in the resulting image is the 3914 cross-correlation of patches of given radius surrounding the voxel in the 3915 two input images. This is different from **-ncor**, which computes a global 3916 cross-correlation metric value. 3917 """ 3918 normalized_cross_correlation: str 3919 """-ncc, -normalized-cross-correlation: Compute normalized cross-correlation 3920 image 3921 3922 Syntax: `-ncc <radius_vector>` 3923 3924 Computes normalized cross-correlation between two images that occupy the 3925 same physical space. Each voxel in the resulting image is the 3926 cross-correlation of patches of given radius surrounding the voxel in the 3927 two input images. This is different from **-ncor**, which computes a global 3928 cross-correlation metric value.""" 3929 3930 def run( 3931 self, 3932 execution: Execution, 3933 ) -> list[str]: 3934 """ 3935 Build command line arguments. This method is called by the main command. 3936 3937 Args: 3938 execution: The execution object. 3939 Returns: 3940 Command line arguments 3941 """ 3942 cargs = [] 3943 cargs.extend([ 3944 "-ncc", 3945 self.normalized_cross_correlation 3946 ]) 3947 return cargs 3948 3949 3950@dataclasses.dataclass 3951class C3dNormalizedCorrelation: 3952 """ 3953 -ncor, -normalized-correlation: Compute normalized correlation metric 3954 3955 Syntax: `-ncor [movtransform.mat] [reftransform.mat]` 3956 3957 : Compute the normalized correlation metric between the last two images on 3958 the stack. See documentation for **-msq***. 3959 """ 3960 normalized_correlation: str 3961 """-ncor, -normalized-correlation: Compute normalized correlation metric 3962 3963 Syntax: `-ncor [movtransform.mat] [reftransform.mat]` 3964 3965 : Compute the normalized correlation metric between the last two images on 3966 the stack. See documentation for **-msq***.""" 3967 3968 def run( 3969 self, 3970 execution: Execution, 3971 ) -> list[str]: 3972 """ 3973 Build command line arguments. This method is called by the main command. 3974 3975 Args: 3976 execution: The execution object. 3977 Returns: 3978 Command line arguments 3979 """ 3980 cargs = [] 3981 cargs.extend([ 3982 "-ncor", 3983 self.normalized_correlation 3984 ]) 3985 return cargs 3986 3987 3988@dataclasses.dataclass 3989class C3dNormalizedMutualInfo: 3990 """ 3991 -mmi, -mattes-mutual-info: Compute mutual informaiton metric 3992 3993 Syntax: `-nmi [movtransform.mat] [reftransform.mat]` 3994 3995 Compute the Mattes mutual information metric between the last two images on 3996 the stack. See documentation for **-msq**. 3997 """ 3998 normalized_mutual_info: str 3999 """-mmi, -mattes-mutual-info: Compute mutual informaiton metric 4000 4001 Syntax: `-nmi [movtransform.mat] [reftransform.mat]` 4002 4003 Compute the Mattes mutual information metric between the last two images on 4004 the stack. See documentation for **-msq**.""" 4005 4006 def run( 4007 self, 4008 execution: Execution, 4009 ) -> list[str]: 4010 """ 4011 Build command line arguments. This method is called by the main command. 4012 4013 Args: 4014 execution: The execution object. 4015 Returns: 4016 Command line arguments 4017 """ 4018 cargs = [] 4019 cargs.extend([ 4020 "-nmi", 4021 self.normalized_mutual_info 4022 ]) 4023 return cargs 4024 4025 4026@dataclasses.dataclass 4027class C3dNoiseGaussian: 4028 """ 4029 -noise-gaussian, -noise: Apply additive Gaussian noise 4030 4031 Syntax: `-noise-gaussian <sigma>` 4032 4033 Adds Gaussian noise to an image with zero mean and standard deviation sigma. 4034 Please see [Noise simulation article][15] by G. Lehmann for details. 4035 4036 c3d image.nii -noise-gaussian 5 -o noisy.nii. 4037 """ 4038 noise_gaussian: str 4039 """-noise-gaussian, -noise: Apply additive Gaussian noise 4040 4041 Syntax: `-noise-gaussian <sigma>` 4042 4043 Adds Gaussian noise to an image with zero mean and standard deviation sigma. 4044 Please see [Noise simulation article][15] by G. Lehmann for details. 4045 4046 c3d image.nii -noise-gaussian 5 -o noisy.nii""" 4047 4048 def run( 4049 self, 4050 execution: Execution, 4051 ) -> list[str]: 4052 """ 4053 Build command line arguments. This method is called by the main command. 4054 4055 Args: 4056 execution: The execution object. 4057 Returns: 4058 Command line arguments 4059 """ 4060 cargs = [] 4061 cargs.extend([ 4062 "-noise-gaussian", 4063 self.noise_gaussian 4064 ]) 4065 return cargs 4066 4067 4068@dataclasses.dataclass 4069class C3dNoisePoisson: 4070 """ 4071 -noise-poisson: Apply Poisson noise 4072 Syntax: `-noise-poisson <scale>` 4073 4074 Applies Poisson (shot) noise to an image with given scale. Please see [Noise 4075 simulation article][15] by G. Lehmann for details. 4076 4077 c3d image.nii -noise-poisson 5 -o noisy.nii. 4078 """ 4079 noise_poisson: str 4080 """-noise-poisson: Apply Poisson noise 4081 Syntax: `-noise-poisson <scale>` 4082 4083 Applies Poisson (shot) noise to an image with given scale. Please see [Noise 4084 simulation article][15] by G. Lehmann for details. 4085 4086 c3d image.nii -noise-poisson 5 -o noisy.nii""" 4087 4088 def run( 4089 self, 4090 execution: Execution, 4091 ) -> list[str]: 4092 """ 4093 Build command line arguments. This method is called by the main command. 4094 4095 Args: 4096 execution: The execution object. 4097 Returns: 4098 Command line arguments 4099 """ 4100 cargs = [] 4101 cargs.extend([ 4102 "-noise-poisson", 4103 self.noise_poisson 4104 ]) 4105 return cargs 4106 4107 4108@dataclasses.dataclass 4109class C3dNoiseSpeckle: 4110 """ 4111 -noise-speckle: Apply Poisson noise 4112 Syntax: `-noise-speckle <sigma>` 4113 4114 Applies Speckle noise to an image with given standard deviation. Please see 4115 [Noise simulation article][15] by G. Lehmann for details. 4116 4117 c3d image.nii -noise-speckle 5 -o noisy.nii. 4118 """ 4119 noise_speckle: str 4120 """-noise-speckle: Apply Poisson noise 4121 Syntax: `-noise-speckle <sigma>` 4122 4123 Applies Speckle noise to an image with given standard deviation. Please see 4124 [Noise simulation article][15] by G. Lehmann for details. 4125 4126 c3d image.nii -noise-speckle 5 -o noisy.nii""" 4127 4128 def run( 4129 self, 4130 execution: Execution, 4131 ) -> list[str]: 4132 """ 4133 Build command line arguments. This method is called by the main command. 4134 4135 Args: 4136 execution: The execution object. 4137 Returns: 4138 Command line arguments 4139 """ 4140 cargs = [] 4141 cargs.extend([ 4142 "-noise-speckle", 4143 self.noise_speckle 4144 ]) 4145 return cargs 4146 4147 4148@dataclasses.dataclass 4149class C3dNoiseSaltPepper: 4150 """ 4151 -noise-salt-pepper: Apply salt and pepper noise 4152 Syntax: `-noise-salt-pepper <probability>` 4153 4154 Applies salt and pepper noise to an image with given probability. Please see 4155 [Noise simulation article][15] by G. Lehmann for details. 4156 4157 c3d image.nii -noise-salt-pepper 0.1 -o noisy.nii. 4158 """ 4159 noise_salt_pepper: str 4160 """-noise-salt-pepper: Apply salt and pepper noise 4161 Syntax: `-noise-salt-pepper <probability>` 4162 4163 Applies salt and pepper noise to an image with given probability. Please see 4164 [Noise simulation article][15] by G. Lehmann for details. 4165 4166 c3d image.nii -noise-salt-pepper 0.1 -o noisy.nii""" 4167 4168 def run( 4169 self, 4170 execution: Execution, 4171 ) -> list[str]: 4172 """ 4173 Build command line arguments. This method is called by the main command. 4174 4175 Args: 4176 execution: The execution object. 4177 Returns: 4178 Command line arguments 4179 """ 4180 cargs = [] 4181 cargs.extend([ 4182 "-noise-salt-pepper", 4183 self.noise_salt_pepper 4184 ]) 4185 return cargs 4186 4187 4188@dataclasses.dataclass 4189class C3dNoMulticomponentSplit: 4190 """ 4191 -nomcs, -no-multicomponent-split: Disable splitting of multi-component 4192 images on read 4193 4194 Syntax: `-nomcs` 4195 4196 Used to reverse the effect of previous **-mcs** command. 4197 """ 4198 no_multicomponent_split: str 4199 """-nomcs, -no-multicomponent-split: Disable splitting of multi-component 4200 images on read 4201 4202 Syntax: `-nomcs` 4203 4204 Used to reverse the effect of previous **-mcs** command.""" 4205 4206 def run( 4207 self, 4208 execution: Execution, 4209 ) -> list[str]: 4210 """ 4211 Build command line arguments. This method is called by the main command. 4212 4213 Args: 4214 execution: The execution object. 4215 Returns: 4216 Command line arguments 4217 """ 4218 cargs = [] 4219 cargs.extend([ 4220 "-nomcs", 4221 self.no_multicomponent_split 4222 ]) 4223 return cargs 4224 4225 4226@dataclasses.dataclass 4227class C3dNormalizeLocalWindow: 4228 """ 4229 -nlw, -normalize-local-window: Standardize image intensity using local 4230 neighborhood 4231 4232 Syntax: `-nlw <radius>` 4233 4234 This command takes as inputs an image and a mask image. At each voxel, the 4235 mean of the local neighborhood is subtracted, and the result is divided by 4236 the standard deviation of the neighborhood. The mean and standard deviation 4237 are computed only over the masked region. You might also want to multiply by 4238 the mask. 4239 4240 c3d gray.nii.gz mask.nii.gz -nlw 10x10x10 -o residual.nii.gz. 4241 """ 4242 normalize_local_window: str 4243 """-nlw, -normalize-local-window: Standardize image intensity using local 4244 neighborhood 4245 4246 Syntax: `-nlw <radius>` 4247 4248 This command takes as inputs an image and a mask image. At each voxel, the 4249 mean of the local neighborhood is subtracted, and the result is divided by 4250 the standard deviation of the neighborhood. The mean and standard deviation 4251 are computed only over the masked region. You might also want to multiply by 4252 the mask. 4253 4254 c3d gray.nii.gz mask.nii.gz -nlw 10x10x10 -o residual.nii.gz""" 4255 4256 def run( 4257 self, 4258 execution: Execution, 4259 ) -> list[str]: 4260 """ 4261 Build command line arguments. This method is called by the main command. 4262 4263 Args: 4264 execution: The execution object. 4265 Returns: 4266 Command line arguments 4267 """ 4268 cargs = [] 4269 cargs.extend([ 4270 "-nlw", 4271 self.normalize_local_window 4272 ]) 4273 return cargs 4274 4275 4276@dataclasses.dataclass 4277class C3dNormpdf: 4278 """ 4279 No description found. 4280 """ 4281 normpdf: str 4282 """No description found.""" 4283 4284 def run( 4285 self, 4286 execution: Execution, 4287 ) -> list[str]: 4288 """ 4289 Build command line arguments. This method is called by the main command. 4290 4291 Args: 4292 execution: The execution object. 4293 Returns: 4294 Command line arguments 4295 """ 4296 cargs = [] 4297 cargs.extend([ 4298 "-normpdf", 4299 self.normpdf 4300 ]) 4301 return cargs 4302 4303 4304@dataclasses.dataclass 4305class C3dNoround: 4306 """ 4307 -noround, -round: Floating point rounding behavior 4308 4309 Syntax: `-noround` or `-round ` 4310 4311 By default, **convert3d** will round floating point values when converting 4312 to an integer, short or byte image. This command specifies that rounding 4313 should not be used. Rounding is used to avoid numerical errors stemming from 4314 the internal floating point representation. 4315 4316 c3d image1.img -type short -noround image2.img. 4317 """ 4318 noround: str 4319 """-noround, -round: Floating point rounding behavior 4320 4321 Syntax: `-noround` or `-round ` 4322 4323 By default, **convert3d** will round floating point values when converting 4324 to an integer, short or byte image. This command specifies that rounding 4325 should not be used. Rounding is used to avoid numerical errors stemming from 4326 the internal floating point representation. 4327 4328 c3d image1.img -type short -noround image2.img""" 4329 4330 def run( 4331 self, 4332 execution: Execution, 4333 ) -> list[str]: 4334 """ 4335 Build command line arguments. This method is called by the main command. 4336 4337 Args: 4338 execution: The execution object. 4339 Returns: 4340 Command line arguments 4341 """ 4342 cargs = [] 4343 cargs.extend([ 4344 "-noround", 4345 self.noround 4346 ]) 4347 return cargs 4348 4349 4350@dataclasses.dataclass 4351class C3dNospm: 4352 """ 4353 -spm, -nospm: SPM compatibility in Analyze output 4354 4355 Syntax: `-spm` or `-nospm ` 4356 4357 These options specify whether use the SPM extension to the Analyze 4358 (.hdr,.img) format. When this option is on, the origin field stored by SPM 4359 in the Analyze header will be correctly interpreted. When saving analyze 4360 files, the origin will be set correctly. The default is equivalent to the 4361 **-nospm** option. Best to avoid this issue altogether by using NIFTI and 4362 SPM5 or later. 4363 4364 c3d -spm in.hdr out.img.gz. 4365 """ 4366 nospm: str 4367 """-spm, -nospm: SPM compatibility in Analyze output 4368 4369 Syntax: `-spm` or `-nospm ` 4370 4371 These options specify whether use the SPM extension to the Analyze 4372 (.hdr,.img) format. When this option is on, the origin field stored by SPM 4373 in the Analyze header will be correctly interpreted. When saving analyze 4374 files, the origin will be set correctly. The default is equivalent to the 4375 **-nospm** option. Best to avoid this issue altogether by using NIFTI and 4376 SPM5 or later. 4377 4378 c3d -spm in.hdr out.img.gz""" 4379 4380 def run( 4381 self, 4382 execution: Execution, 4383 ) -> list[str]: 4384 """ 4385 Build command line arguments. This method is called by the main command. 4386 4387 Args: 4388 execution: The execution object. 4389 Returns: 4390 Command line arguments 4391 """ 4392 cargs = [] 4393 cargs.extend([ 4394 "-nospm", 4395 self.nospm 4396 ]) 4397 return cargs 4398 4399 4400@dataclasses.dataclass 4401class C3dOutput: 4402 """ 4403 -o: Output (write) last image on the stack to image file 4404 4405 Syntax: `-o filename` 4406 4407 Write image, overriding an existing image. Without the **-o** option, 4408 **convert3d** will write an image only if it does not exist. The **-o** 4409 options protects input images from being accidentally deleted. Here we copy 4410 an image, changing format: 4411 4412 c3d image1.mha -o image2.nii 4413 4414 The **-o** option can also be used to save an intermediate image in the 4415 stack: 4416 4417 c3d image1.img -threshold 1 10 1 0 -o thresh.img -resample 50% -o final.img. 4418 """ 4419 output: str 4420 """-o: Output (write) last image on the stack to image file 4421 4422 Syntax: `-o filename` 4423 4424 Write image, overriding an existing image. Without the **-o** option, 4425 **convert3d** will write an image only if it does not exist. The **-o** 4426 options protects input images from being accidentally deleted. Here we copy 4427 an image, changing format: 4428 4429 c3d image1.mha -o image2.nii 4430 4431 The **-o** option can also be used to save an intermediate image in the 4432 stack: 4433 4434 c3d image1.img -threshold 1 10 1 0 -o thresh.img -resample 50% -o 4435 final.img""" 4436 4437 def run( 4438 self, 4439 execution: Execution, 4440 ) -> list[str]: 4441 """ 4442 Build command line arguments. This method is called by the main command. 4443 4444 Args: 4445 execution: The execution object. 4446 Returns: 4447 Command line arguments 4448 """ 4449 cargs = [] 4450 cargs.extend([ 4451 "-o", 4452 self.output 4453 ]) 4454 return cargs 4455 4456 4457@dataclasses.dataclass 4458class C3dOutputMulticomponent: 4459 """ 4460 -omc, -output-multicomponent: Output multiple images to single file 4461 4462 Syntax: `-omc [number] filename` 4463 4464 Write multiple images on the **Convert3d** stack as a single multi-component 4465 image file. If the optional number *n* is specified, only the last *n* 4466 images on the stack will be used. Not all file formats support 4467 multi-component output. NIFTI is the safest bet. 4468 4469 c3d red.nii green.nii blue.nii -omc rgb.mha 4470 4471 For 2D images, this command can be used to generate color PNG files: 4472 4473 c3d image.nii -slice z 50% -colormap jet -type uchar -omc colorslice.png. 4474 """ 4475 output_multicomponent: str 4476 """-omc, -output-multicomponent: Output multiple images to single file 4477 4478 Syntax: `-omc [number] filename` 4479 4480 Write multiple images on the **Convert3d** stack as a single multi-component 4481 image file. If the optional number *n* is specified, only the last *n* 4482 images on the stack will be used. Not all file formats support 4483 multi-component output. NIFTI is the safest bet. 4484 4485 c3d red.nii green.nii blue.nii -omc rgb.mha 4486 4487 For 2D images, this command can be used to generate color PNG files: 4488 4489 c3d image.nii -slice z 50% -colormap jet -type uchar -omc colorslice.png""" 4490 4491 def run( 4492 self, 4493 execution: Execution, 4494 ) -> list[str]: 4495 """ 4496 Build command line arguments. This method is called by the main command. 4497 4498 Args: 4499 execution: The execution object. 4500 Returns: 4501 Command line arguments 4502 """ 4503 cargs = [] 4504 cargs.extend([ 4505 "-omc", 4506 self.output_multicomponent 4507 ]) 4508 return cargs 4509 4510 4511@dataclasses.dataclass 4512class C3dOutputMultipleMulticomponent: 4513 """ 4514 -oomc: Output multiple multi-component images to multiple files 4515 4516 Syntax: `-oomc n_comp image_list` or `-oomc n_comp image_spec` 4517 4518 Write all images on the **convert3d** stack as multiple multi-component 4519 image files. The command is a mixture of the **-omc** and **-oo** commands. 4520 There must be a multiple of 'n_comp' images on the stack. Every consecutive 4521 'n_comp' images on the stack will be written to a separate multi-component 4522 image. 4523 4524 ### Commands: Stack Manipulation and Flow Control 4525 4526 These commands are used to manipulate the **convert3d** stack. The stack is 4527 a linear array of images. Every time an image is specified on the command 4528 line, it is loaded and placed at the end of the stack. Most operations take 4529 one image from the end of the stack, apply some operation to it, and place 4530 the result on the end of the stack. Certain commands like **-levelset** and 4531 **-reslice-matrix** take two images from the end of the stack as the input 4532 and replace them with a single output. Some other commands, like **-mean** 4533 and **-vote** take all images on the stack and replace them with a single 4534 output. 4535 4536 Sometimes, for complex operations, it is useful to change the order of the 4537 images on the stack, to duplicate images, or to execute the same command 4538 multiple times. The stack manipulation and flow control commands allow you 4539 to complete complex tasks without saving intermediate images to the disk. 4540 """ 4541 output_multiple_multicomponent: str 4542 """-oomc: Output multiple multi-component images to multiple files 4543 4544 Syntax: `-oomc n_comp image_list` or `-oomc n_comp image_spec` 4545 4546 Write all images on the **convert3d** stack as multiple multi-component 4547 image files. The command is a mixture of the **-omc** and **-oo** commands. 4548 There must be a multiple of 'n_comp' images on the stack. Every consecutive 4549 'n_comp' images on the stack will be written to a separate multi-component 4550 image. 4551 4552 ### Commands: Stack Manipulation and Flow Control 4553 4554 These commands are used to manipulate the **convert3d** stack. The stack is 4555 a linear array of images. Every time an image is specified on the command 4556 line, it is loaded and placed at the end of the stack. Most operations take 4557 one image from the end of the stack, apply some operation to it, and place 4558 the result on the end of the stack. Certain commands like **-levelset** and 4559 **-reslice-matrix** take two images from the end of the stack as the input 4560 and replace them with a single output. Some other commands, like **-mean** 4561 and **-vote** take all images on the stack and replace them with a single 4562 output. 4563 4564 Sometimes, for complex operations, it is useful to change the order of the 4565 images on the stack, to duplicate images, or to execute the same command 4566 multiple times. The stack manipulation and flow control commands allow you 4567 to complete complex tasks without saving intermediate images to the disk.""" 4568 4569 def run( 4570 self, 4571 execution: Execution, 4572 ) -> list[str]: 4573 """ 4574 Build command line arguments. This method is called by the main command. 4575 4576 Args: 4577 execution: The execution object. 4578 Returns: 4579 Command line arguments 4580 """ 4581 cargs = [] 4582 cargs.extend([ 4583 "-oomc", 4584 self.output_multiple_multicomponent 4585 ]) 4586 return cargs 4587 4588 4589@dataclasses.dataclass 4590class C3dOrient: 4591 """ 4592 -orient: Change image orientation 4593 4594 Syntax: `-orient CODE` 4595 4596 Set the orientation of the image using one of 48 canonical orientations. The 4597 orientation describes the mapping from the voxel coordinate system (i,j,k) 4598 to the physical coordinate system (x,y,z). In the voxel coordinate system, i 4599 runs along columns of voxels, j runs along rows of voxels, and k runs along 4600 slices of voxels. It is assumed (by the NIFTI convention) that the axes of 4601 the physical coordinate system run as follows: x from (L)eft to (R)ight, y 4602 from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior. 4603 4604 The CODE passed in is a three-letter code consisting of letters RLAPSI. Each 4605 letter describes the anatomical direction corresponding to the voxel 4606 coordinates (i,j,k). For example, code RAI means that i runs from Right to 4607 Left, j from Anterior to Posterior, and k from Inferior to Superior. 4608 4609 c3d input.img -orient RAI -o output.img 4610 c3d input.img -orient SAL -o output.img 4611 4612 This command has the same behavior as the 'Reorient Image' menu option in 4613 ITK-SNAP. 4614 """ 4615 orient: str 4616 """-orient: Change image orientation 4617 4618 Syntax: `-orient CODE` 4619 4620 Set the orientation of the image using one of 48 canonical orientations. The 4621 orientation describes the mapping from the voxel coordinate system (i,j,k) 4622 to the physical coordinate system (x,y,z). In the voxel coordinate system, i 4623 runs along columns of voxels, j runs along rows of voxels, and k runs along 4624 slices of voxels. It is assumed (by the NIFTI convention) that the axes of 4625 the physical coordinate system run as follows: x from (L)eft to (R)ight, y 4626 from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior. 4627 4628 The CODE passed in is a three-letter code consisting of letters RLAPSI. Each 4629 letter describes the anatomical direction corresponding to the voxel 4630 coordinates (i,j,k). For example, code RAI means that i runs from Right to 4631 Left, j from Anterior to Posterior, and k from Inferior to Superior. 4632 4633 c3d input.img -orient RAI -o output.img 4634 c3d input.img -orient SAL -o output.img 4635 4636 This command has the same behavior as the 'Reorient Image' menu option in 4637 ITK-SNAP.""" 4638 4639 def run( 4640 self, 4641 execution: Execution, 4642 ) -> list[str]: 4643 """ 4644 Build command line arguments. This method is called by the main command. 4645 4646 Args: 4647 execution: The execution object. 4648 Returns: 4649 Command line arguments 4650 """ 4651 cargs = [] 4652 cargs.extend([ 4653 "-orient", 4654 self.orient 4655 ]) 4656 return cargs 4657 4658 4659@dataclasses.dataclass 4660class C3dOutputMultiple: 4661 """ 4662 -oo: Output multiple images to multiple files 4663 4664 Syntax: `-oo image_list` or `-oo image_spec` 4665 4666 Write all images on the **convert3d** stack as multiple files. There are two 4667 ways to use this command. The first is to supply a list of file names, 4668 separated by spaces: 4669 4670 c3d labelimage.nii -split -oo labelA.nii labelB.nii labelC.nii 4671 4672 In the above example, the image at the end of the stack will be saved as 4673 *labelC.nii*, the image next to the end of the stack will be saved as 4674 *labelB.nii* and so on. 4675 4676 The second way to use the **-oo** command is to supply a pattern for the 4677 output filenames. In this case, all the images on the stack will be written. 4678 The format for the pattern is the same as for the [C++ printf command][8]. 4679 For example, the following command 4680 4681 c3d labelimage.nii -split -oo label%02d.nii 4682 4683 will generate images *label00.nii*, *label01.nii*, *label02.nii* and so on. 4684 The image at the end of the stack will have the highest number, and the 4685 image at the beginning of the stack will have number 00. 4686 """ 4687 output_multiple: str 4688 """-oo: Output multiple images to multiple files 4689 4690 Syntax: `-oo image_list` or `-oo image_spec` 4691 4692 Write all images on the **convert3d** stack as multiple files. There are two 4693 ways to use this command. The first is to supply a list of file names, 4694 separated by spaces: 4695 4696 c3d labelimage.nii -split -oo labelA.nii labelB.nii labelC.nii 4697 4698 In the above example, the image at the end of the stack will be saved as 4699 *labelC.nii*, the image next to the end of the stack will be saved as 4700 *labelB.nii* and so on. 4701 4702 The second way to use the **-oo** command is to supply a pattern for the 4703 output filenames. In this case, all the images on the stack will be written. 4704 The format for the pattern is the same as for the [C++ printf command][8]. 4705 For example, the following command 4706 4707 c3d labelimage.nii -split -oo label%02d.nii 4708 4709 will generate images *label00.nii*, *label01.nii*, *label02.nii* and so on. 4710 The image at the end of the stack will have the highest number, and the 4711 image at the beginning of the stack will have number 00.""" 4712 4713 def run( 4714 self, 4715 execution: Execution, 4716 ) -> list[str]: 4717 """ 4718 Build command line arguments. This method is called by the main command. 4719 4720 Args: 4721 execution: The execution object. 4722 Returns: 4723 Command line arguments 4724 """ 4725 cargs = [] 4726 cargs.extend([ 4727 "-oo", 4728 self.output_multiple 4729 ]) 4730 return cargs 4731 4732 4733@dataclasses.dataclass 4734class C3dOrient_: 4735 """ 4736 -orient: Change image orientation 4737 4738 Syntax: `-orient CODE` 4739 4740 Set the orientation of the image using one of 48 canonical orientations. The 4741 orientation describes the mapping from the voxel coordinate system (i,j,k) 4742 to the physical coordinate system (x,y,z). In the voxel coordinate system, i 4743 runs along columns of voxels, j runs along rows of voxels, and k runs along 4744 slices of voxels. It is assumed (by the NIFTI convention) that the axes of 4745 the physical coordinate system run as follows: x from (L)eft to (R)ight, y 4746 from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior. 4747 4748 The CODE passed in is a three-letter code consisting of letters RLAPSI. Each 4749 letter describes the anatomical direction corresponding to the voxel 4750 coordinates (i,j,k). For example, code RAI means that i runs from Right to 4751 Left, j from Anterior to Posterior, and k from Inferior to Superior. 4752 4753 c3d input.img -orient RAI -o output.img 4754 c3d input.img -orient SAL -o output.img 4755 4756 This command has the same behavior as the 'Reorient Image' menu option in 4757 ITK-SNAP. 4758 """ 4759 orient: str 4760 """-orient: Change image orientation 4761 4762 Syntax: `-orient CODE` 4763 4764 Set the orientation of the image using one of 48 canonical orientations. The 4765 orientation describes the mapping from the voxel coordinate system (i,j,k) 4766 to the physical coordinate system (x,y,z). In the voxel coordinate system, i 4767 runs along columns of voxels, j runs along rows of voxels, and k runs along 4768 slices of voxels. It is assumed (by the NIFTI convention) that the axes of 4769 the physical coordinate system run as follows: x from (L)eft to (R)ight, y 4770 from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior. 4771 4772 The CODE passed in is a three-letter code consisting of letters RLAPSI. Each 4773 letter describes the anatomical direction corresponding to the voxel 4774 coordinates (i,j,k). For example, code RAI means that i runs from Right to 4775 Left, j from Anterior to Posterior, and k from Inferior to Superior. 4776 4777 c3d input.img -orient RAI -o output.img 4778 c3d input.img -orient SAL -o output.img 4779 4780 This command has the same behavior as the 'Reorient Image' menu option in 4781 ITK-SNAP.""" 4782 4783 def run( 4784 self, 4785 execution: Execution, 4786 ) -> list[str]: 4787 """ 4788 Build command line arguments. This method is called by the main command. 4789 4790 Args: 4791 execution: The execution object. 4792 Returns: 4793 Command line arguments 4794 """ 4795 cargs = [] 4796 cargs.extend([ 4797 "-orient", 4798 self.orient 4799 ]) 4800 return cargs 4801 4802 4803@dataclasses.dataclass 4804class C3dOrigin: 4805 """ 4806 -origin: Set image origin 4807 4808 Syntax: `-origin vector ` 4809 4810 Set the origin of the image. The origin is the world coordinate (in NIfTI 4811 coordinate space) of the center of the voxel (0,0,0) in the image. The 4812 origin should be specified in millimeters. 4813 4814 c3d input.img -origin 100x100x100mm -o output.img. 4815 """ 4816 origin: str 4817 """-origin: Set image origin 4818 4819 Syntax: `-origin vector ` 4820 4821 Set the origin of the image. The origin is the world coordinate (in NIfTI 4822 coordinate space) of the center of the voxel (0,0,0) in the image. The 4823 origin should be specified in millimeters. 4824 4825 c3d input.img -origin 100x100x100mm -o output.img""" 4826 4827 def run( 4828 self, 4829 execution: Execution, 4830 ) -> list[str]: 4831 """ 4832 Build command line arguments. This method is called by the main command. 4833 4834 Args: 4835 execution: The execution object. 4836 Returns: 4837 Command line arguments 4838 """ 4839 cargs = [] 4840 cargs.extend([ 4841 "-origin", 4842 self.origin 4843 ]) 4844 return cargs 4845 4846 4847@dataclasses.dataclass 4848class C3dOriginVoxel: 4849 """ 4850 -origin-voxel: Assign image origin to a voxel 4851 4852 Syntax: `-origin-voxel vector ` 4853 4854 Set the origin of the image by specifying the voxel coordinates of the 4855 center of the patient (RAS) coordinate system. The vector should be 4856 specified in voxel units. 4857 4858 c3d input.img -origin-voxel 60x70x35 -o output.img 4859 c3d input.img -origin-voxel 50% -o output.img # image centered around 4860 origin. 4861 """ 4862 origin_voxel: str 4863 """-origin-voxel: Assign image origin to a voxel 4864 4865 Syntax: `-origin-voxel vector ` 4866 4867 Set the origin of the image by specifying the voxel coordinates of the 4868 center of the patient (RAS) coordinate system. The vector should be 4869 specified in voxel units. 4870 4871 c3d input.img -origin-voxel 60x70x35 -o output.img 4872 c3d input.img -origin-voxel 50% -o output.img # image centered around 4873 origin""" 4874 4875 def run( 4876 self, 4877 execution: Execution, 4878 ) -> list[str]: 4879 """ 4880 Build command line arguments. This method is called by the main command. 4881 4882 Args: 4883 execution: The execution object. 4884 Returns: 4885 Command line arguments 4886 """ 4887 cargs = [] 4888 cargs.extend([ 4889 "-origin-voxel", 4890 self.origin_voxel 4891 ]) 4892 return cargs 4893 4894 4895@dataclasses.dataclass 4896class C3dOriginVoxelCoord: 4897 """ 4898 -origin-voxel-coord: Set coordinate of specified voxel 4899 4900 Syntax: `-origin-voxel-coord: <index> <vector>` 4901 4902 This command updates the origin of the image such that the specifed voxel 4903 has the specified coordinate. For example, you can use the command to set 4904 the world coordinate (in NIFTI coordinate space) of the center voxel of the 4905 image, as follows: 4906 4907 c3d input.nii -origin-voxel-coord: 50% 10x10x5mm -o output.nii. 4908 """ 4909 origin_voxel_coord: str 4910 """-origin-voxel-coord: Set coordinate of specified voxel 4911 4912 Syntax: `-origin-voxel-coord: <index> <vector>` 4913 4914 This command updates the origin of the image such that the specifed voxel 4915 has the specified coordinate. For example, you can use the command to set 4916 the world coordinate (in NIFTI coordinate space) of the center voxel of the 4917 image, as follows: 4918 4919 c3d input.nii -origin-voxel-coord: 50% 10x10x5mm -o output.nii""" 4920 4921 def run( 4922 self, 4923 execution: Execution, 4924 ) -> list[str]: 4925 """ 4926 Build command line arguments. This method is called by the main command. 4927 4928 Args: 4929 execution: The execution object. 4930 Returns: 4931 Command line arguments 4932 """ 4933 cargs = [] 4934 cargs.extend([ 4935 "-origin-voxel-coord", 4936 self.origin_voxel_coord 4937 ]) 4938 return cargs 4939 4940 4941@dataclasses.dataclass 4942class C3dOverlap: 4943 """ 4944 -overlap: Compute relative overlap between binary images 4945 4946 Syntax: `-overlap Z` 4947 4948 Compute relative overlap between labels in the last two images on the stack. 4949 Overlap is computed for a given label **Z**, i.e., the number of voxels that 4950 are equal to **Z** in both images is computed and divided by either the 4951 average number of voxels equal to **Z** in both images (to get Dice 4952 coefficient) or by the size of the region where at least one of the images 4953 is equal to **Z** (Jaccard coefficient). 4954 4955 The command below computes overlap for label 255. 4956 4957 c3d -verbose seg1.img seg2.img -overlap 255 4958 4959 The output of the command is in the following terse format, with the last 4960 two values giving Dice and Jaccard coefficients, respectively. 4961 4962 OVL: 1, 2383, 2474, 1807, 0.744081, 0.592459 4963 4964 Use the flag **-verbose** to get full information. 4965 4966 Matching voxels in first image: 2383 4967 Matching voxels in second image: 2474 4968 Size of overlap region: 1807 4969 Dice similarity coefficient: 0.744081 4970 Intersection / ratio: 0.592459 4971 4972 This command does not alter the stack. 4973 """ 4974 overlap: str 4975 """-overlap: Compute relative overlap between binary images 4976 4977 Syntax: `-overlap Z` 4978 4979 Compute relative overlap between labels in the last two images on the stack. 4980 Overlap is computed for a given label **Z**, i.e., the number of voxels that 4981 are equal to **Z** in both images is computed and divided by either the 4982 average number of voxels equal to **Z** in both images (to get Dice 4983 coefficient) or by the size of the region where at least one of the images 4984 is equal to **Z** (Jaccard coefficient). 4985 4986 The command below computes overlap for label 255. 4987 4988 c3d -verbose seg1.img seg2.img -overlap 255 4989 4990 The output of the command is in the following terse format, with the last 4991 two values giving Dice and Jaccard coefficients, respectively. 4992 4993 OVL: 1, 2383, 2474, 1807, 0.744081, 0.592459 4994 4995 Use the flag **-verbose** to get full information. 4996 4997 Matching voxels in first image: 2383 4998 Matching voxels in second image: 2474 4999 Size of overlap region: 1807 5000 Dice similarity coefficient: 0.744081 5001 Intersection / ratio: 0.592459 5002 5003 This command does not alter the stack.""" 5004 5005 def run( 5006 self, 5007 execution: Execution, 5008 ) -> list[str]: 5009 """ 5010 Build command line arguments. This method is called by the main command. 5011 5012 Args: 5013 execution: The execution object. 5014 Returns: 5015 Command line arguments 5016 """ 5017 cargs = [] 5018 cargs.extend([ 5019 "-overlap", 5020 self.overlap 5021 ]) 5022 return cargs 5023 5024 5025@dataclasses.dataclass 5026class C3dOverlayLabelImage: 5027 """ 5028 -oli, -overlay-label-image: Overlay segmentation image on grayscale image 5029 5030 Syntax: `-oli lookup_table_file opacity` 5031 5032 This command takes a grayscale image and a label image (i.e. image with a 5033 set of discrete values) and produces red, green and blue components of a 5034 color image. The resulting color image is an overlay of the labels over the 5035 grey image. The first parameter (*lookup\_table*) is a text file with 5036 entries in the format 5037 5038 label_value red green blue alpha 5039 5040 Alpha values must be between 0 and 1. Red, green and blue values should be 5041 on the same order as the intensity of the grey image (typically 0-255). The 5042 text file is compatible with ITK-SNAP and can be generated using the 5043 ITK-SNAP `Segmentation->Save Label Descriptions` command. The second 5044 parameter (*opacity*) is between 0 and 1 and sets the overall opacity of the 5045 overlay. The output of this command is similar to the way ITK-SNAP presents 5046 segmentation data on top of grayscale images. 5047 5048 c3d gray.nii.gz -stretch 2% 98% 0 255 -clip 0 255 seg.nii.gz -oli labels.txt 5049 0.5 -omc rgb.nii.gz 5050 5051 Note: this command does not interpolate between entries in the lookup table. 5052 It should not be used for images with a continuous intensity spectrum. 5053 5054 Here is a more complex example, used to visualize a segmentation result. We 5055 do a few things in this command: trim grayscale and segmentation images to 5056 an ROI around the object of interest; map intensity range of the grayscale 5057 image to 0-255; extract slices through the middle of the cropped images; 5058 overlay segmentation on the grayscale image; and save as a color PNG file. 5059 5060 c3d seg.nii.gz -trim 20x20x0vox -as S gray.nii.gz -stretch 2% 98% 0 255 5061 -clip 0 255 \\ 5062 -reslice-identity -push S -foreach -slice z 50% -flip xy -endfor \\ 5063 -oli labels.txt 0.5 -type uchar -omc ovl.png. 5064 """ 5065 overlay_label_image: str 5066 """-oli, -overlay-label-image: Overlay segmentation image on grayscale image 5067 5068 Syntax: `-oli lookup_table_file opacity` 5069 5070 This command takes a grayscale image and a label image (i.e. image with a 5071 set of discrete values) and produces red, green and blue components of a 5072 color image. The resulting color image is an overlay of the labels over the 5073 grey image. The first parameter (*lookup\_table*) is a text file with 5074 entries in the format 5075 5076 label_value red green blue alpha 5077 5078 Alpha values must be between 0 and 1. Red, green and blue values should be 5079 on the same order as the intensity of the grey image (typically 0-255). The 5080 text file is compatible with ITK-SNAP and can be generated using the 5081 ITK-SNAP `Segmentation->Save Label Descriptions` command. The second 5082 parameter (*opacity*) is between 0 and 1 and sets the overall opacity of the 5083 overlay. The output of this command is similar to the way ITK-SNAP presents 5084 segmentation data on top of grayscale images. 5085 5086 c3d gray.nii.gz -stretch 2% 98% 0 255 -clip 0 255 seg.nii.gz -oli labels.txt 5087 0.5 -omc rgb.nii.gz 5088 5089 Note: this command does not interpolate between entries in the lookup table. 5090 It should not be used for images with a continuous intensity spectrum. 5091 5092 Here is a more complex example, used to visualize a segmentation result. We 5093 do a few things in this command: trim grayscale and segmentation images to 5094 an ROI around the object of interest; map intensity range of the grayscale 5095 image to 0-255; extract slices through the middle of the cropped images; 5096 overlay segmentation on the grayscale image; and save as a color PNG file. 5097 5098 c3d seg.nii.gz -trim 20x20x0vox -as S gray.nii.gz -stretch 2% 98% 0 255 5099 -clip 0 255 \\ 5100 -reslice-identity -push S -foreach -slice z 50% -flip xy -endfor \\ 5101 -oli labels.txt 0.5 -type uchar -omc ovl.png""" 5102 5103 def run( 5104 self, 5105 execution: Execution, 5106 ) -> list[str]: 5107 """ 5108 Build command line arguments. This method is called by the main command. 5109 5110 Args: 5111 execution: The execution object. 5112 Returns: 5113 Command line arguments 5114 """ 5115 cargs = [] 5116 cargs.extend([ 5117 "-overlay-label-image", 5118 self.overlay_label_image 5119 ]) 5120 return cargs 5121 5122 5123@dataclasses.dataclass 5124class C3dPad: 5125 """ 5126 -pad: Pad image with constant value 5127 5128 Syntax: `-pad <padlower> <padupper> <value> ` 5129 5130 Pads the image by a given percentage or number of voxels. The *padlower* 5131 dimension pads along the zero faces of the image, and the *padupper* 5132 dimension pads along the upper faces of the image. For example to add 1 5133 voxel to the left side of an image, do 5134 5135 c3d img1.nii -pad 1x0x0vox 0x0x0vox 0 -o padded.nii 5136 5137 while 5138 5139 c3d img1.nii -pad 2x2x4vox 0% 0 -o padded.nii 5140 5141 adds two voxels padding to the left and posterior sides, and four slices to 5142 the bottom of the image. Note that the first argument changes the location 5143 of voxel (0,0,0) and thus the origin of the output image will be changed to 5144 maintain anatomical alignment between the padded and original images. 5145 5146 Normally you will want to pad with zeros, but you can pad with any constant 5147 value, eg : 5148 5149 c3d img1.nii -pad 10% 10% 1 -o padded.nii 5150 5151 Adds 10% to all sides of the image, and fills the new voxels with the value 5152 1. 5153 """ 5154 pad: str 5155 """-pad: Pad image with constant value 5156 5157 Syntax: `-pad <padlower> <padupper> <value> ` 5158 5159 Pads the image by a given percentage or number of voxels. The *padlower* 5160 dimension pads along the zero faces of the image, and the *padupper* 5161 dimension pads along the upper faces of the image. For example to add 1 5162 voxel to the left side of an image, do 5163 5164 c3d img1.nii -pad 1x0x0vox 0x0x0vox 0 -o padded.nii 5165 5166 while 5167 5168 c3d img1.nii -pad 2x2x4vox 0% 0 -o padded.nii 5169 5170 adds two voxels padding to the left and posterior sides, and four slices to 5171 the bottom of the image. Note that the first argument changes the location 5172 of voxel (0,0,0) and thus the origin of the output image will be changed to 5173 maintain anatomical alignment between the padded and original images. 5174 5175 Normally you will want to pad with zeros, but you can pad with any constant 5176 value, eg : 5177 5178 c3d img1.nii -pad 10% 10% 1 -o padded.nii 5179 5180 Adds 10% to all sides of the image, and fills the new voxels with the value 5181 1.""" 5182 5183 def run( 5184 self, 5185 execution: Execution, 5186 ) -> list[str]: 5187 """ 5188 Build command line arguments. This method is called by the main command. 5189 5190 Args: 5191 execution: The execution object. 5192 Returns: 5193 Command line arguments 5194 """ 5195 cargs = [] 5196 cargs.extend([ 5197 "-pad", 5198 self.pad 5199 ]) 5200 return cargs 5201 5202 5203@dataclasses.dataclass 5204class C3dPadTo: 5205 """ 5206 No description found. 5207 """ 5208 pad_to: str 5209 """No description found.""" 5210 5211 def run( 5212 self, 5213 execution: Execution, 5214 ) -> list[str]: 5215 """ 5216 Build command line arguments. This method is called by the main command. 5217 5218 Args: 5219 execution: The execution object. 5220 Returns: 5221 Command line arguments 5222 """ 5223 cargs = [] 5224 cargs.extend([ 5225 "-padto", 5226 self.pad_to 5227 ]) 5228 return cargs 5229 5230 5231@dataclasses.dataclass 5232class C3dPca: 5233 """ 5234 -pca: Principal components analysis of foreground voxels 5235 5236 Syntax: `-pca` 5237 5238 Similar to the *-centroid* command, computes the centroid and prinicipal 5239 components of the foregrond voxels in the image. For example if the image is 5240 a binary image of an ellipsoid, this will report the center and the 5241 principal axes of the ellipsoid, in physical NIFTI coordinates. 5242 5243 c3d binaryimage.img -pca // centroid of all non-0 voxels 5244 c3d labelimage.img -thresh 5 5 1 0 -pca // centroid of all voxels with label 5245 5 5246 c3d labelimage.img -split -foreach -pca -endfor // centroids of all labels 5247 (including 0). 5248 """ 5249 pca: str 5250 """-pca: Principal components analysis of foreground voxels 5251 5252 Syntax: `-pca` 5253 5254 Similar to the *-centroid* command, computes the centroid and prinicipal 5255 components of the foregrond voxels in the image. For example if the image is 5256 a binary image of an ellipsoid, this will report the center and the 5257 principal axes of the ellipsoid, in physical NIFTI coordinates. 5258 5259 c3d binaryimage.img -pca // centroid of all non-0 voxels 5260 c3d labelimage.img -thresh 5 5 1 0 -pca // centroid of all voxels with label 5261 5 5262 c3d labelimage.img -split -foreach -pca -endfor // centroids of all labels 5263 (including 0)""" 5264 5265 def run( 5266 self, 5267 execution: Execution, 5268 ) -> list[str]: 5269 """ 5270 Build command line arguments. This method is called by the main command. 5271 5272 Args: 5273 execution: The execution object. 5274 Returns: 5275 Command line arguments 5276 """ 5277 cargs = [] 5278 cargs.extend([ 5279 "-pca", 5280 self.pca 5281 ]) 5282 return cargs 5283 5284 5285@dataclasses.dataclass 5286class C3dPercentIntensityMode: 5287 """ 5288 -pim, -percent-intensity-mode: Set behavior of % specifier 5289 5290 Syntax: `-pim Quantile | q | ForegroundQuantile | fq | Range | r` 5291 5292 This options changes how the percent sign (%) is interpreted when specifying 5293 intensity values. **Quantile (q)** means that `10%` describes the 10th 5294 percentile of all intensity values in the image (i.e., 10% of the voxels 5295 have lower intensity). **ForegroundQuantile (fq)** is similar, but voxels 5296 with background intensity (see **-background** option) are excluded from the 5297 percentile computation. **Range (r)** changes the meaning of percent sign 5298 from percentile to the range between the minimum and maximum of the image, 5299 and `0.1%` becomes equal to MIN + 0.1 (MAX - MIN). The default is 5300 **Quantile**. 5301 5302 $ c3d comp01.png -verbose -pim Quantile -verbose -threshold 75% inf 1 0 5303 Quantile 0.75 maps to 18 5304 5305 $ c3d comp01.png -verbose -pim ForegroundQuantile -verbose -threshold 75% 5306 inf 1 0 5307 Foreground quantile 0.75 (over 37467 voxels) maps to 58 5308 5309 $ c3d comp01.png -verbose -pim Range -verbose -threshold 75% inf 1 0 5310 Intensity range spec 0.75 maps to 191.25. 5311 """ 5312 percent_intensity_mode: str 5313 """-pim, -percent-intensity-mode: Set behavior of % specifier 5314 5315 Syntax: `-pim Quantile | q | ForegroundQuantile | fq | Range | r` 5316 5317 This options changes how the percent sign (%) is interpreted when specifying 5318 intensity values. **Quantile (q)** means that `10%` describes the 10th 5319 percentile of all intensity values in the image (i.e., 10% of the voxels 5320 have lower intensity). **ForegroundQuantile (fq)** is similar, but voxels 5321 with background intensity (see **-background** option) are excluded from the 5322 percentile computation. **Range (r)** changes the meaning of percent sign 5323 from percentile to the range between the minimum and maximum of the image, 5324 and `0.1%` becomes equal to MIN + 0.1 (MAX - MIN). The default is 5325 **Quantile**. 5326 5327 $ c3d comp01.png -verbose -pim Quantile -verbose -threshold 75% inf 1 0 5328 Quantile 0.75 maps to 18 5329 5330 $ c3d comp01.png -verbose -pim ForegroundQuantile -verbose -threshold 75% 5331 inf 1 0 5332 Foreground quantile 0.75 (over 37467 voxels) maps to 58 5333 5334 $ c3d comp01.png -verbose -pim Range -verbose -threshold 75% inf 1 0 5335 Intensity range spec 0.75 maps to 191.25""" 5336 5337 def run( 5338 self, 5339 execution: Execution, 5340 ) -> list[str]: 5341 """ 5342 Build command line arguments. This method is called by the main command. 5343 5344 Args: 5345 execution: The execution object. 5346 Returns: 5347 Command line arguments 5348 """ 5349 cargs = [] 5350 cargs.extend([ 5351 "-percent-intensity-mode", 5352 self.percent_intensity_mode 5353 ]) 5354 return cargs 5355 5356 5357@dataclasses.dataclass 5358class C3dPixel: 5359 """ 5360 No description found. 5361 """ 5362 pixel: str 5363 """No description found.""" 5364 5365 def run( 5366 self, 5367 execution: Execution, 5368 ) -> list[str]: 5369 """ 5370 Build command line arguments. This method is called by the main command. 5371 5372 Args: 5373 execution: The execution object. 5374 Returns: 5375 Command line arguments 5376 """ 5377 cargs = [] 5378 cargs.extend([ 5379 "-pixel", 5380 self.pixel 5381 ]) 5382 return cargs 5383 5384 5385@dataclasses.dataclass 5386class C3dPop: 5387 """ 5388 -pop: Remove last image from the stack 5389 5390 Syntax: `-pop` 5391 5392 Removes the last image from the image stack. Images assigned a name with the 5393 **-as** command will remain in memory. 5394 """ 5395 pop_: str 5396 """-pop: Remove last image from the stack 5397 5398 Syntax: `-pop` 5399 5400 Removes the last image from the image stack. Images assigned a name with the 5401 **-as** command will remain in memory.""" 5402 5403 def run( 5404 self, 5405 execution: Execution, 5406 ) -> list[str]: 5407 """ 5408 Build command line arguments. This method is called by the main command. 5409 5410 Args: 5411 execution: The execution object. 5412 Returns: 5413 Command line arguments 5414 """ 5415 cargs = [] 5416 cargs.extend([ 5417 "-pop", 5418 self.pop_ 5419 ]) 5420 return cargs 5421 5422 5423@dataclasses.dataclass 5424class C3dPopas: 5425 """ 5426 -popas: Remove last image from the stack and assign to variable 5427 5428 Syntax: `-popas var` 5429 5430 Removes the last image from the stack, but also assigns it the name 'var', 5431 keeping the image in memory. Same as calling **-as** *var* followed by 5432 **-pop**. 5433 """ 5434 popas: str 5435 """-popas: Remove last image from the stack and assign to variable 5436 5437 Syntax: `-popas var` 5438 5439 Removes the last image from the stack, but also assigns it the name 'var', 5440 keeping the image in memory. Same as calling **-as** *var* followed by 5441 **-pop**.""" 5442 5443 def run( 5444 self, 5445 execution: Execution, 5446 ) -> list[str]: 5447 """ 5448 Build command line arguments. This method is called by the main command. 5449 5450 Args: 5451 execution: The execution object. 5452 Returns: 5453 Command line arguments 5454 """ 5455 cargs = [] 5456 cargs.extend([ 5457 "-popas", 5458 self.popas 5459 ]) 5460 return cargs 5461 5462 5463@dataclasses.dataclass 5464class C3dProbe: 5465 """ 5466 -probe: Report image intensity at a voxel 5467 5468 Syntax: `-probe <point_spec>` 5469 5470 Prints the value of the image at the position specified by the parameter 5471 `point_spec`, which may be in physical units or voxel units: 5472 5473 c3d img1.img -probe 128x120x160vox 5474 c3d img1.img -interpolation NearestNeighbor -probe 60x60x60mm 5475 c3d img1.img -probe 50%. 5476 """ 5477 probe: str 5478 """-probe: Report image intensity at a voxel 5479 5480 Syntax: `-probe <point_spec>` 5481 5482 Prints the value of the image at the position specified by the parameter 5483 `point_spec`, which may be in physical units or voxel units: 5484 5485 c3d img1.img -probe 128x120x160vox 5486 c3d img1.img -interpolation NearestNeighbor -probe 60x60x60mm 5487 c3d img1.img -probe 50%""" 5488 5489 def run( 5490 self, 5491 execution: Execution, 5492 ) -> list[str]: 5493 """ 5494 Build command line arguments. This method is called by the main command. 5495 5496 Args: 5497 execution: The execution object. 5498 Returns: 5499 Command line arguments 5500 """ 5501 cargs = [] 5502 cargs.extend([ 5503 "-probe", 5504 self.probe 5505 ]) 5506 return cargs 5507 5508 5509@dataclasses.dataclass 5510class C3dPush: 5511 """ 5512 -push: Place variable at the end of the stack 5513 5514 Syntax: `-push var` 5515 5516 Places the image associated with variable name 'var' on end of the image 5517 stack. Variable names are assigned using the **-as** command. The **-as** 5518 and **-push** commands are useful when you need to use a certain image more 5519 than once during a convert3d operation. For example, if you want to compute 5520 the distance transform of a binary image and mask it so that the values 5521 outside of the binary image region have value 0, you would use the following 5522 command: 5523 5524 c3d binary.img -as A -sdt -push A -times -o masked_distance.img. 5525 """ 5526 push: str 5527 """-push: Place variable at the end of the stack 5528 5529 Syntax: `-push var` 5530 5531 Places the image associated with variable name 'var' on end of the image 5532 stack. Variable names are assigned using the **-as** command. The **-as** 5533 and **-push** commands are useful when you need to use a certain image more 5534 than once during a convert3d operation. For example, if you want to compute 5535 the distance transform of a binary image and mask it so that the values 5536 outside of the binary image region have value 0, you would use the following 5537 command: 5538 5539 c3d binary.img -as A -sdt -push A -times -o masked_distance.img""" 5540 5541 def run( 5542 self, 5543 execution: Execution, 5544 ) -> list[str]: 5545 """ 5546 Build command line arguments. This method is called by the main command. 5547 5548 Args: 5549 execution: The execution object. 5550 Returns: 5551 Command line arguments 5552 """ 5553 cargs = [] 5554 cargs.extend([ 5555 "-push", 5556 self.push 5557 ]) 5558 return cargs 5559 5560 5561@dataclasses.dataclass 5562class C3dRank: 5563 """ 5564 -rank: Voxelwise ranking of intensity values 5565 5566 Syntax: `-rank ` 5567 5568 This command takes N images as the input (all the images on the stack are 5569 used). It also generates N images as the output. For voxel k in image j, it 5570 assigns it a label based on its rank among the values of voxel k in all N 5571 images. If the voxel has highest intensity in image j, then the j'th output 5572 will have value 1. 5573 5574 c3d img1.img img2.img ... imgN.img -rank -oo rank%d.img. 5575 """ 5576 rank: str 5577 """-rank: Voxelwise ranking of intensity values 5578 5579 Syntax: `-rank ` 5580 5581 This command takes N images as the input (all the images on the stack are 5582 used). It also generates N images as the output. For voxel k in image j, it 5583 assigns it a label based on its rank among the values of voxel k in all N 5584 images. If the voxel has highest intensity in image j, then the j'th output 5585 will have value 1. 5586 5587 c3d img1.img img2.img ... imgN.img -rank -oo rank%d.img""" 5588 5589 def run( 5590 self, 5591 execution: Execution, 5592 ) -> list[str]: 5593 """ 5594 Build command line arguments. This method is called by the main command. 5595 5596 Args: 5597 execution: The execution object. 5598 Returns: 5599 Command line arguments 5600 """ 5601 cargs = [] 5602 cargs.extend([ 5603 "-rank", 5604 self.rank 5605 ]) 5606 return cargs 5607 5608 5609@dataclasses.dataclass 5610class C3dReciprocal: 5611 """ 5612 -reciprocal: Image voxelwise reciprocal 5613 5614 Syntax: `-reciprocal ` 5615 5616 Computes the reciprocal of an image. For instance to compute B = 1 / A, use 5617 the command 5618 5619 c3d A.img -reciprocal -o B.img. 5620 """ 5621 reciprocal: str 5622 """-reciprocal: Image voxelwise reciprocal 5623 5624 Syntax: `-reciprocal ` 5625 5626 Computes the reciprocal of an image. For instance to compute B = 1 / A, use 5627 the command 5628 5629 c3d A.img -reciprocal -o B.img""" 5630 5631 def run( 5632 self, 5633 execution: Execution, 5634 ) -> list[str]: 5635 """ 5636 Build command line arguments. This method is called by the main command. 5637 5638 Args: 5639 execution: The execution object. 5640 Returns: 5641 Command line arguments 5642 """ 5643 cargs = [] 5644 cargs.extend([ 5645 "-reciprocal", 5646 self.reciprocal 5647 ]) 5648 return cargs 5649 5650 5651@dataclasses.dataclass 5652class C3dRegion: 5653 """ 5654 -region: Extract region from image 5655 5656 Syntax: `-region vOrigin vSize ` 5657 5658 Extract a rectangular region from the image. The first parameter is the 5659 position of the corner of the region, and the second is the size of the 5660 region. 5661 5662 c3d img1.img -region 20x20x20vox 50x60x70vox -o img2.img 5663 c3d img1.img -region 25% 50% -o img3.img. 5664 """ 5665 region: str 5666 """-region: Extract region from image 5667 5668 Syntax: `-region vOrigin vSize ` 5669 5670 Extract a rectangular region from the image. The first parameter is the 5671 position of the corner of the region, and the second is the size of the 5672 region. 5673 5674 c3d img1.img -region 20x20x20vox 50x60x70vox -o img2.img 5675 c3d img1.img -region 25% 50% -o img3.img""" 5676 5677 def run( 5678 self, 5679 execution: Execution, 5680 ) -> list[str]: 5681 """ 5682 Build command line arguments. This method is called by the main command. 5683 5684 Args: 5685 execution: The execution object. 5686 Returns: 5687 Command line arguments 5688 """ 5689 cargs = [] 5690 cargs.extend([ 5691 "-region", 5692 self.region 5693 ]) 5694 return cargs 5695 5696 5697@dataclasses.dataclass 5698class C3dReorder: 5699 """ 5700 -reorder: Rearrange images on the stack 5701 5702 Syntax: `-reorder k` or `-reorder fraction` 5703 5704 Rearranges images in the stack, such that images that are k positions apart 5705 become next to each other on the stack. In other words, if the original 5706 order of the images is 1, 2, ..., n, the new order of the images becomes 1, 5707 1+k, 1+2k, ..., 2, 2+k, 2+2k, ..., k, 2k, ... n. Of course, n must be 5708 divisible by k. As an alternative to specifying k, you can specify a 5709 floating point number (i.e., **-reorder** 0.5), in which case k is obtained 5710 by multiplying n by the floating point number and rounding to the nearest 5711 integer. 5712 5713 The following three commands are equivalent: 5714 5715 c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 4 ... 5716 c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 0.5 ... 5717 c3d a1.nii b1.nii a2.nii b2.nii a3.nii b3.nii a4.nii b4.nii ... 5718 5719 The **-reorder** command us useful when you specify two sets of images using 5720 wildcards and then want to perform pairwise operations on the images. For 5721 example 5722 5723 c3d weight*.nii gray*.nii -reorder 0.5 -weighted-sum-voxelwise -o wsum.nii 5724 5725 is equivalent to the command 5726 5727 c3d weight1.nii gray1.nii weight2.nii gray2.nii ... -weighted-sum-voxelwise 5728 -o wsum.nii. 5729 """ 5730 reorder: str 5731 """-reorder: Rearrange images on the stack 5732 5733 Syntax: `-reorder k` or `-reorder fraction` 5734 5735 Rearranges images in the stack, such that images that are k positions apart 5736 become next to each other on the stack. In other words, if the original 5737 order of the images is 1, 2, ..., n, the new order of the images becomes 1, 5738 1+k, 1+2k, ..., 2, 2+k, 2+2k, ..., k, 2k, ... n. Of course, n must be 5739 divisible by k. As an alternative to specifying k, you can specify a 5740 floating point number (i.e., **-reorder** 0.5), in which case k is obtained 5741 by multiplying n by the floating point number and rounding to the nearest 5742 integer. 5743 5744 The following three commands are equivalent: 5745 5746 c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 4 ... 5747 c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 0.5 ... 5748 c3d a1.nii b1.nii a2.nii b2.nii a3.nii b3.nii a4.nii b4.nii ... 5749 5750 The **-reorder** command us useful when you specify two sets of images using 5751 wildcards and then want to perform pairwise operations on the images. For 5752 example 5753 5754 c3d weight*.nii gray*.nii -reorder 0.5 -weighted-sum-voxelwise -o wsum.nii 5755 5756 is equivalent to the command 5757 5758 c3d weight1.nii gray1.nii weight2.nii gray2.nii ... -weighted-sum-voxelwise 5759 -o wsum.nii""" 5760 5761 def run( 5762 self, 5763 execution: Execution, 5764 ) -> list[str]: 5765 """ 5766 Build command line arguments. This method is called by the main command. 5767 5768 Args: 5769 execution: The execution object. 5770 Returns: 5771 Command line arguments 5772 """ 5773 cargs = [] 5774 cargs.extend([ 5775 "-reorder", 5776 self.reorder 5777 ]) 5778 return cargs 5779 5780 5781@dataclasses.dataclass 5782class C3dRetainLabels: 5783 """ 5784 -retain-labels: Retain labels in a label image 5785 5786 Syntax: `-retain-labels I1 I2 ... IN` 5787 5788 Assuming that the input is a multi-label segmentation image, this command 5789 keeps all labels specifed in the list and replaces the remaining labels with 5790 the background value. 5791 5792 c3d seg.nii -retain-labels 2 3 4 8 -o subseg.nii. 5793 """ 5794 retain_labels: str 5795 """-retain-labels: Retain labels in a label image 5796 5797 Syntax: `-retain-labels I1 I2 ... IN` 5798 5799 Assuming that the input is a multi-label segmentation image, this command 5800 keeps all labels specifed in the list and replaces the remaining labels with 5801 the background value. 5802 5803 c3d seg.nii -retain-labels 2 3 4 8 -o subseg.nii""" 5804 5805 def run( 5806 self, 5807 execution: Execution, 5808 ) -> list[str]: 5809 """ 5810 Build command line arguments. This method is called by the main command. 5811 5812 Args: 5813 execution: The execution object. 5814 Returns: 5815 Command line arguments 5816 """ 5817 cargs = [] 5818 cargs.extend([ 5819 "-retain-labels", 5820 self.retain_labels 5821 ]) 5822 return cargs 5823 5824 5825@dataclasses.dataclass 5826class C3dRfApply: 5827 """ 5828 -rf-apply: Apply Random Forest classifier 5829 5830 Syntax: `-rf-apply <classifier_file>` 5831 5832 This command applies a classifier trained previously by **-rf-train**. The 5833 stack must contain the same number of feature images as when training. The 5834 images will be removed from the stack and replaced with a set of K 5835 probability images, where K is the number of classes during training. See 5836 examples under **-rf-train** for usage. 5837 """ 5838 rf_apply: str 5839 """-rf-apply: Apply Random Forest classifier 5840 5841 Syntax: `-rf-apply <classifier_file>` 5842 5843 This command applies a classifier trained previously by **-rf-train**. The 5844 stack must contain the same number of feature images as when training. The 5845 images will be removed from the stack and replaced with a set of K 5846 probability images, where K is the number of classes during training. See 5847 examples under **-rf-train** for usage.""" 5848 5849 def run( 5850 self, 5851 execution: Execution, 5852 ) -> list[str]: 5853 """ 5854 Build command line arguments. This method is called by the main command. 5855 5856 Args: 5857 execution: The execution object. 5858 Returns: 5859 Command line arguments 5860 """ 5861 cargs = [] 5862 cargs.extend([ 5863 "-rf-apply", 5864 self.rf_apply 5865 ]) 5866 return cargs 5867 5868 5869@dataclasses.dataclass 5870class C3dRfTrain: 5871 """ 5872 -rf-train: Train Random Forest classifier 5873 5874 Syntax: `-rf-train <classifier_file>` 5875 5876 This command trains a classifier using an implementation of the [Breyman et 5877 al. Random Forest Algorithm][Br2001], with modifications proposed by 5878 [Criminisi and Shotton][Cr2004]. The stack must contain one or more images 5879 of features (e.g., grayscale images), followed by a multi-label image. The 5880 latter must have at least two non-zero labels corresponding to different 5881 classes. The classifier is trained on a voxel by voxel basis. All voxels 5882 with label *L* are treated as the examples of class *L*. The classifier is 5883 output to a binary file that can later be used by the **-rf-apply** command. 5884 Multiple parameters can be specified with the **-rf-param-xxx** options 5885 before calling **-rf-train**. The stack is not modified by this command. 5886 5887 # Training with two MRI modalities as features and default parameters 5888 c3d t1_mri.nii t2_mri.nii segmentation.nii -rf-train myforest1.rf 5889 5890 # Training with patches as features (see docs for -rf-param-patch) 5891 c3d ultrasound.nii seg.nii -rf-param-patch 2x2x2 -rf-train myforest2.rf 5892 5893 # Applying the classifier 5894 c3d ultrasound.nii -rf-apply myforest2.rf -omc class_prob.nii.gz 5895 5896 The commands are meant to replicate the "classification" pre-segmentation 5897 mode in ITK-SNAP, i.e., extending a rough example segmentation to the entire 5898 image domain. It is possible to also use the commands to train classifiers 5899 jointly on data from multiple subjects, each with its own segmentation, as 5900 long as the images from the different subjects occupy the same image space 5901 and can be stacked into a 4-dimensional image. For example: 5902 5903 # Train using MRI and segmentations from N subjects 5904 c4d mri_subj*.nii -tile w -popas ALLMRI \ 5905 seg_subj*.nii -tile w -popas ALLSEG \ 5906 -rf-param-patch 2x2x2x0 \ 5907 -push ALLMRI -push ALLSEG -rf-train myforest.rf 5908 5909 # Apply using single MRI 5910 c4d mri_new.nii -rf-apply myforest.rf -omc classprob.nii 5911 5912 [Br2001] Breiman, L. (2001). Random forests. Machine learning, 45(1), 5-32. 5913 [Cr2004] Criminisi, A., & Shotton, J. (2013). Decision forests for computer 5914 vision and medical image analysis. Springer Science & Business Media. 5915 """ 5916 rf_train: str 5917 """-rf-train: Train Random Forest classifier 5918 5919 Syntax: `-rf-train <classifier_file>` 5920 5921 This command trains a classifier using an implementation of the [Breyman et 5922 al. Random Forest Algorithm][Br2001], with modifications proposed by 5923 [Criminisi and Shotton][Cr2004]. The stack must contain one or more images 5924 of features (e.g., grayscale images), followed by a multi-label image. The 5925 latter must have at least two non-zero labels corresponding to different 5926 classes. The classifier is trained on a voxel by voxel basis. All voxels 5927 with label *L* are treated as the examples of class *L*. The classifier is 5928 output to a binary file that can later be used by the **-rf-apply** command. 5929 Multiple parameters can be specified with the **-rf-param-xxx** options 5930 before calling **-rf-train**. The stack is not modified by this command. 5931 5932 # Training with two MRI modalities as features and default parameters 5933 c3d t1_mri.nii t2_mri.nii segmentation.nii -rf-train myforest1.rf 5934 5935 # Training with patches as features (see docs for -rf-param-patch) 5936 c3d ultrasound.nii seg.nii -rf-param-patch 2x2x2 -rf-train myforest2.rf 5937 5938 # Applying the classifier 5939 c3d ultrasound.nii -rf-apply myforest2.rf -omc class_prob.nii.gz 5940 5941 The commands are meant to replicate the "classification" pre-segmentation 5942 mode in ITK-SNAP, i.e., extending a rough example segmentation to the entire 5943 image domain. It is possible to also use the commands to train classifiers 5944 jointly on data from multiple subjects, each with its own segmentation, as 5945 long as the images from the different subjects occupy the same image space 5946 and can be stacked into a 4-dimensional image. For example: 5947 5948 # Train using MRI and segmentations from N subjects 5949 c4d mri_subj*.nii -tile w -popas ALLMRI \ 5950 seg_subj*.nii -tile w -popas ALLSEG \ 5951 -rf-param-patch 2x2x2x0 \ 5952 -push ALLMRI -push ALLSEG -rf-train myforest.rf 5953 5954 # Apply using single MRI 5955 c4d mri_new.nii -rf-apply myforest.rf -omc classprob.nii 5956 5957 [Br2001] Breiman, L. (2001). Random forests. Machine learning, 45(1), 5-32. 5958 [Cr2004] Criminisi, A., & Shotton, J. (2013). Decision forests for computer 5959 vision and medical image analysis. Springer Science & Business Media""" 5960 5961 def run( 5962 self, 5963 execution: Execution, 5964 ) -> list[str]: 5965 """ 5966 Build command line arguments. This method is called by the main command. 5967 5968 Args: 5969 execution: The execution object. 5970 Returns: 5971 Command line arguments 5972 """ 5973 cargs = [] 5974 cargs.extend([ 5975 "-rf-train", 5976 self.rf_train 5977 ]) 5978 return cargs 5979 5980 5981@dataclasses.dataclass 5982class C3dRfParamPatch: 5983 """ 5984 -rf-param-patch: Random Forest training patch size 5985 5986 Syntax: `-rf-param-patch <size_spec>` 5987 5988 Set the radius of the patch used to generate features for the RF classifier. 5989 By default this is zero, which means that just the intensity of each voxel 5990 is used as a feature. Setting this to non-zero values will result in 5991 neighboring intensities also being used as features, and can improve 5992 classification in presence of complex image texture. The patch size in each 5993 dimension is (2 * radius + 1). See **-rf-train** command for details. 5994 5995 # Set patch size to 5x5x5 5996 c3d ... -rf-param-patch 2x2x2 ... -rf-train myforest.rf. 5997 """ 5998 rf_param_patch: str 5999 """-rf-param-patch: Random Forest training patch size 6000 6001 Syntax: `-rf-param-patch <size_spec>` 6002 6003 Set the radius of the patch used to generate features for the RF classifier. 6004 By default this is zero, which means that just the intensity of each voxel 6005 is used as a feature. Setting this to non-zero values will result in 6006 neighboring intensities also being used as features, and can improve 6007 classification in presence of complex image texture. The patch size in each 6008 dimension is (2 * radius + 1). See **-rf-train** command for details. 6009 6010 # Set patch size to 5x5x5 6011 c3d ... -rf-param-patch 2x2x2 ... -rf-train myforest.rf""" 6012 6013 def run( 6014 self, 6015 execution: Execution, 6016 ) -> list[str]: 6017 """ 6018 Build command line arguments. This method is called by the main command. 6019 6020 Args: 6021 execution: The execution object. 6022 Returns: 6023 Command line arguments 6024 """ 6025 cargs = [] 6026 cargs.extend([ 6027 "-rf-param-patch", 6028 self.rf_param_patch 6029 ]) 6030 return cargs 6031 6032 6033@dataclasses.dataclass 6034class C3dRfParamUsexyz: 6035 """ 6036 -rf-param-usexyz: Random Forest coordinate features 6037 6038 Syntax: `-rf-param-usexyz` 6039 6040 Use the coordinates of voxels as additional features. This allows some 6041 geometric relations between different labels to be learned. Equivalent to 6042 the corresponding ITK-SNAP option. 6043 """ 6044 rf_param_usexyz: str 6045 """-rf-param-usexyz: Random Forest coordinate features 6046 6047 Syntax: `-rf-param-usexyz` 6048 6049 Use the coordinates of voxels as additional features. This allows some 6050 geometric relations between different labels to be learned. Equivalent to 6051 the corresponding ITK-SNAP option.""" 6052 6053 def run( 6054 self, 6055 execution: Execution, 6056 ) -> list[str]: 6057 """ 6058 Build command line arguments. This method is called by the main command. 6059 6060 Args: 6061 execution: The execution object. 6062 Returns: 6063 Command line arguments 6064 """ 6065 cargs = [] 6066 cargs.extend([ 6067 "-rf-param-usexyz", 6068 self.rf_param_usexyz 6069 ]) 6070 return cargs 6071 6072 6073@dataclasses.dataclass 6074class C3dRfParamNousexyz: 6075 """ 6076 No description found. 6077 """ 6078 rf_param_nousexyz: str 6079 """No description found.""" 6080 6081 def run( 6082 self, 6083 execution: Execution, 6084 ) -> list[str]: 6085 """ 6086 Build command line arguments. This method is called by the main command. 6087 6088 Args: 6089 execution: The execution object. 6090 Returns: 6091 Command line arguments 6092 """ 6093 cargs = [] 6094 cargs.extend([ 6095 "-rf-param-nousexyz", 6096 self.rf_param_nousexyz 6097 ]) 6098 return cargs 6099 6100 6101@dataclasses.dataclass 6102class C3dRfParamNtrees: 6103 """ 6104 -rf-param-ntrees: Random Forest forest size 6105 6106 Syntax: `-rf-param-ntrees <integer>` 6107 6108 Sets the number of trees in the forest. Default value is 50. Larger forests 6109 are more robust but more time to train and apply. 6110 """ 6111 rf_param_ntrees: str 6112 """-rf-param-ntrees: Random Forest forest size 6113 6114 Syntax: `-rf-param-ntrees <integer>` 6115 6116 Sets the number of trees in the forest. Default value is 50. Larger forests 6117 are more robust but more time to train and apply.""" 6118 6119 def run( 6120 self, 6121 execution: Execution, 6122 ) -> list[str]: 6123 """ 6124 Build command line arguments. This method is called by the main command. 6125 6126 Args: 6127 execution: The execution object. 6128 Returns: 6129 Command line arguments 6130 """ 6131 cargs = [] 6132 cargs.extend([ 6133 "-rf-param-ntrees", 6134 self.rf_param_ntrees 6135 ]) 6136 return cargs 6137 6138 6139@dataclasses.dataclass 6140class C3dRfParamTreedepth: 6141 """ 6142 -rf-param-treedepth: Random Forest tree depth 6143 6144 Syntax: `-rf-param-treedepth <integer>` 6145 6146 Sets the depth of the trees in the classifier. Default value is 30. Deeper 6147 trees can learn on more complex data but require more time. 6148 """ 6149 rf_param_treedepth: str 6150 """-rf-param-treedepth: Random Forest tree depth 6151 6152 Syntax: `-rf-param-treedepth <integer>` 6153 6154 Sets the depth of the trees in the classifier. Default value is 30. Deeper 6155 trees can learn on more complex data but require more time.""" 6156 6157 def run( 6158 self, 6159 execution: Execution, 6160 ) -> list[str]: 6161 """ 6162 Build command line arguments. This method is called by the main command. 6163 6164 Args: 6165 execution: The execution object. 6166 Returns: 6167 Command line arguments 6168 """ 6169 cargs = [] 6170 cargs.extend([ 6171 "-rf-param-treedepth", 6172 self.rf_param_treedepth 6173 ]) 6174 return cargs 6175 6176 6177@dataclasses.dataclass 6178class C3dSetSform: 6179 """ 6180 -set-sform: Set the transform to physical space 6181 6182 Syntax: `-set-sform <sform.mat> ` 6183 6184 Sets the Nifti sform of the last image on the stack to the 4x4 matrix 6185 provided. 6186 """ 6187 set_sform: str 6188 """-set-sform: Set the transform to physical space 6189 6190 Syntax: `-set-sform <sform.mat> ` 6191 6192 Sets the Nifti sform of the last image on the stack to the 4x4 matrix 6193 provided.""" 6194 6195 def run( 6196 self, 6197 execution: Execution, 6198 ) -> list[str]: 6199 """ 6200 Build command line arguments. This method is called by the main command. 6201 6202 Args: 6203 execution: The execution object. 6204 Returns: 6205 Command line arguments 6206 """ 6207 cargs = [] 6208 cargs.extend([ 6209 "-set-sform", 6210 self.set_sform 6211 ]) 6212 return cargs 6213 6214 6215@dataclasses.dataclass 6216class C3dReplace: 6217 """ 6218 -replace: Replace intensities in image 6219 6220 Syntax: `-replace I1 J1 I2 J2 ... ` 6221 6222 Replace intensity I1 by J1, I2 by J2 and so on. Allowed values of intensity 6223 include **nan**, **inf** and **-inf**. 6224 6225 c3d img1.img -replace 1 128 nan 0.0 -o img2.img. 6226 """ 6227 replace: str 6228 """-replace: Replace intensities in image 6229 6230 Syntax: `-replace I1 J1 I2 J2 ... ` 6231 6232 Replace intensity I1 by J1, I2 by J2 and so on. Allowed values of intensity 6233 include **nan**, **inf** and **-inf**. 6234 6235 c3d img1.img -replace 1 128 nan 0.0 -o img2.img""" 6236 6237 def run( 6238 self, 6239 execution: Execution, 6240 ) -> list[str]: 6241 """ 6242 Build command line arguments. This method is called by the main command. 6243 6244 Args: 6245 execution: The execution object. 6246 Returns: 6247 Command line arguments 6248 """ 6249 cargs = [] 6250 cargs.extend([ 6251 "-replace", 6252 self.replace 6253 ]) 6254 return cargs 6255 6256 6257@dataclasses.dataclass 6258class C3dResample: 6259 """ 6260 -resample: Resample image to new dimensions 6261 6262 Syntax: `-resample <dimensions> ` 6263 6264 Resamples the image, keeping the bounding box the same, but changing the 6265 number of voxels in the image. The dimensions can be specified as a 6266 percentage, for example to double the number of voxels in each direction. 6267 The **-interpolation** flag affects how sampling is performed. 6268 6269 c3d img1.img -resample 123x142x200 -o img2.img 6270 c3d img1.img -resample 200% -o img2.img 6271 c3d img1.img -resample 100x100x200% -o img2.img 6272 c3d img1.img -background 4.0 -interpolation Cubic -resample 123x142x200 -o 6273 img2.img. 6274 """ 6275 resample: str 6276 """-resample: Resample image to new dimensions 6277 6278 Syntax: `-resample <dimensions> ` 6279 6280 Resamples the image, keeping the bounding box the same, but changing the 6281 number of voxels in the image. The dimensions can be specified as a 6282 percentage, for example to double the number of voxels in each direction. 6283 The **-interpolation** flag affects how sampling is performed. 6284 6285 c3d img1.img -resample 123x142x200 -o img2.img 6286 c3d img1.img -resample 200% -o img2.img 6287 c3d img1.img -resample 100x100x200% -o img2.img 6288 c3d img1.img -background 4.0 -interpolation Cubic -resample 123x142x200 -o 6289 img2.img""" 6290 6291 def run( 6292 self, 6293 execution: Execution, 6294 ) -> list[str]: 6295 """ 6296 Build command line arguments. This method is called by the main command. 6297 6298 Args: 6299 execution: The execution object. 6300 Returns: 6301 Command line arguments 6302 """ 6303 cargs = [] 6304 cargs.extend([ 6305 "-resample", 6306 self.resample 6307 ]) 6308 return cargs 6309 6310 6311@dataclasses.dataclass 6312class C3dResampleIso: 6313 """ 6314 -resample-iso: Resample image to (approximately) isotropic resolution 6315 6316 Syntax: `-resample-iso <min|max>` 6317 6318 Resamples the image to have approximately isotropic resolution, either based 6319 on the smallest voxel dimension ('min' mode) or largest voxel dimension 6320 ('max' mode). This command calls **-resample** with appropriately calculated 6321 new image dimensions. The bounding box of the image in physical space is 6322 preserved. Therefore, since the image dimensions must be integer, the actual 6323 voxel dimensions after resampling may not be precisely isotropic. 6324 6325 c3d img1.img -resample-iso min -o img2.img. 6326 """ 6327 resample_iso: str 6328 """-resample-iso: Resample image to (approximately) isotropic resolution 6329 6330 Syntax: `-resample-iso <min|max>` 6331 6332 Resamples the image to have approximately isotropic resolution, either based 6333 on the smallest voxel dimension ('min' mode) or largest voxel dimension 6334 ('max' mode). This command calls **-resample** with appropriately calculated 6335 new image dimensions. The bounding box of the image in physical space is 6336 preserved. Therefore, since the image dimensions must be integer, the actual 6337 voxel dimensions after resampling may not be precisely isotropic. 6338 6339 c3d img1.img -resample-iso min -o img2.img""" 6340 6341 def run( 6342 self, 6343 execution: Execution, 6344 ) -> list[str]: 6345 """ 6346 Build command line arguments. This method is called by the main command. 6347 6348 Args: 6349 execution: The execution object. 6350 Returns: 6351 Command line arguments 6352 """ 6353 cargs = [] 6354 cargs.extend([ 6355 "-resample-iso", 6356 self.resample_iso 6357 ]) 6358 return cargs 6359 6360 6361@dataclasses.dataclass 6362class C3dResampleMm: 6363 """ 6364 -resample-mm: Resample image to new resolution 6365 6366 Syntax: `-resample-mm <voxel_size> ` 6367 6368 Resamples the image as in **-resample**, but the user specifies the new 6369 voxel size rather than dimensions. This may not be precise, so the bounding 6370 box of the image may change. A warning will be generated in that case. 6371 6372 c3d img1.img -resample-mm 1.0x1.5x1.5mm -o img2.img. 6373 """ 6374 resample_mm: str 6375 """-resample-mm: Resample image to new resolution 6376 6377 Syntax: `-resample-mm <voxel_size> ` 6378 6379 Resamples the image as in **-resample**, but the user specifies the new 6380 voxel size rather than dimensions. This may not be precise, so the bounding 6381 box of the image may change. A warning will be generated in that case. 6382 6383 c3d img1.img -resample-mm 1.0x1.5x1.5mm -o img2.img""" 6384 6385 def run( 6386 self, 6387 execution: Execution, 6388 ) -> list[str]: 6389 """ 6390 Build command line arguments. This method is called by the main command. 6391 6392 Args: 6393 execution: The execution object. 6394 Returns: 6395 Command line arguments 6396 """ 6397 cargs = [] 6398 cargs.extend([ 6399 "-resample-mm", 6400 self.resample_mm 6401 ]) 6402 return cargs 6403 6404 6405@dataclasses.dataclass 6406class C3dResliceItk: 6407 """ 6408 -reslice-itk: Resample image using affine transform 6409 6410 Syntax: `-reslice-itk <transform_file> ` 6411 6412 Applies affine (or other) transform in ITK (ANTs) format to an image. See 6413 notes to **-reslice-matrix** for usage. 6414 """ 6415 reslice_itk: str 6416 """-reslice-itk: Resample image using affine transform 6417 6418 Syntax: `-reslice-itk <transform_file> ` 6419 6420 Applies affine (or other) transform in ITK (ANTs) format to an image. See 6421 notes to **-reslice-matrix** for usage.""" 6422 6423 def run( 6424 self, 6425 execution: Execution, 6426 ) -> list[str]: 6427 """ 6428 Build command line arguments. This method is called by the main command. 6429 6430 Args: 6431 execution: The execution object. 6432 Returns: 6433 Command line arguments 6434 """ 6435 cargs = [] 6436 cargs.extend([ 6437 "-reslice-itk", 6438 self.reslice_itk 6439 ]) 6440 return cargs 6441 6442 6443@dataclasses.dataclass 6444class C3dResliceMatrix: 6445 """ 6446 No description found. 6447 """ 6448 reslice_matrix: str 6449 """No description found.""" 6450 6451 def run( 6452 self, 6453 execution: Execution, 6454 ) -> list[str]: 6455 """ 6456 Build command line arguments. This method is called by the main command. 6457 6458 Args: 6459 execution: The execution object. 6460 Returns: 6461 Command line arguments 6462 """ 6463 cargs = [] 6464 cargs.extend([ 6465 "-reslice-matrix", 6466 self.reslice_matrix 6467 ]) 6468 return cargs 6469 6470 6471@dataclasses.dataclass 6472class C3dResliceIdentity: 6473 """ 6474 -reslice-identity: Resample image using identity transform 6475 6476 Syntax: `-reslice-identity ` 6477 6478 Applies the **-reslice-matrix** command with the identity transform. This is 6479 useful when you have two scans of the same subject with different coordinate 6480 transformations to patient space and you want to resample one scan in the 6481 space of another scan. For example, if you have T1 and T2 images in 6482 different coordinate frames, and want to reslice the T2 image into the space 6483 of the T1 6484 6485 c3d t1.nii t2.nii -reslice-identity -o t2_in_t1_space.nii. 6486 """ 6487 reslice_identity: str 6488 """-reslice-identity: Resample image using identity transform 6489 6490 Syntax: `-reslice-identity ` 6491 6492 Applies the **-reslice-matrix** command with the identity transform. This is 6493 useful when you have two scans of the same subject with different coordinate 6494 transformations to patient space and you want to resample one scan in the 6495 space of another scan. For example, if you have T1 and T2 images in 6496 different coordinate frames, and want to reslice the T2 image into the space 6497 of the T1 6498 6499 c3d t1.nii t2.nii -reslice-identity -o t2_in_t1_space.nii""" 6500 6501 def run( 6502 self, 6503 execution: Execution, 6504 ) -> list[str]: 6505 """ 6506 Build command line arguments. This method is called by the main command. 6507 6508 Args: 6509 execution: The execution object. 6510 Returns: 6511 Command line arguments 6512 """ 6513 cargs = [] 6514 cargs.extend([ 6515 "-reslice-identity", 6516 self.reslice_identity 6517 ]) 6518 return cargs 6519 6520 6521@dataclasses.dataclass 6522class C3dRgb2hsv: 6523 """ 6524 -rgb2hsv: Convert RGB image to HSV image 6525 6526 Syntax `-rgb2hsv` 6527 6528 Takes the last three images on the stack and treats them as red, green, and 6529 blue channels. Outputs three images corresponding to hue, saturation, value. 6530 To read color images you need the ***-msc*** command. 6531 6532 c3d -mcs color.png -rgb2hsv -omc hsv.png. 6533 """ 6534 rgb2hsv: str 6535 """-rgb2hsv: Convert RGB image to HSV image 6536 6537 Syntax `-rgb2hsv` 6538 6539 Takes the last three images on the stack and treats them as red, green, and 6540 blue channels. Outputs three images corresponding to hue, saturation, value. 6541 To read color images you need the ***-msc*** command. 6542 6543 c3d -mcs color.png -rgb2hsv -omc hsv.png""" 6544 6545 def run( 6546 self, 6547 execution: Execution, 6548 ) -> list[str]: 6549 """ 6550 Build command line arguments. This method is called by the main command. 6551 6552 Args: 6553 execution: The execution object. 6554 Returns: 6555 Command line arguments 6556 """ 6557 cargs = [] 6558 cargs.extend([ 6559 "-rgb2hsv", 6560 self.rgb2hsv 6561 ]) 6562 return cargs 6563 6564 6565@dataclasses.dataclass 6566class C3dRms: 6567 """ 6568 -rms: Voxelwise vector norm 6569 6570 Syntax: `-rms` 6571 6572 Computes RMS (root mean square) of all images on the stack. The command 6573 takes the square of each image on the stack, adds all the squared images and 6574 takes the square root of the result. This is very useful for statistical 6575 operations. Images must have the same size. 6576 6577 c3d img1.img img2.img img3.img img4.img -rms -o rms.img 6578 6579 The equivalent of this command is 6580 6581 c3d img1.img img2.img img3.img img4.img -foreach -dup -times -endfor \ 6582 -accum -add -endaccum -sqrt -o rms.img. 6583 """ 6584 rms: str 6585 """-rms: Voxelwise vector norm 6586 6587 Syntax: `-rms` 6588 6589 Computes RMS (root mean square) of all images on the stack. The command 6590 takes the square of each image on the stack, adds all the squared images and 6591 takes the square root of the result. This is very useful for statistical 6592 operations. Images must have the same size. 6593 6594 c3d img1.img img2.img img3.img img4.img -rms -o rms.img 6595 6596 The equivalent of this command is 6597 6598 c3d img1.img img2.img img3.img img4.img -foreach -dup -times -endfor \ 6599 -accum -add -endaccum -sqrt -o rms.img""" 6600 6601 def run( 6602 self, 6603 execution: Execution, 6604 ) -> list[str]: 6605 """ 6606 Build command line arguments. This method is called by the main command. 6607 6608 Args: 6609 execution: The execution object. 6610 Returns: 6611 Command line arguments 6612 """ 6613 cargs = [] 6614 cargs.extend([ 6615 "-rms", 6616 self.rms 6617 ]) 6618 return cargs 6619 6620 6621@dataclasses.dataclass 6622class C3dRound: 6623 """ 6624 -noround, -round: Floating point rounding behavior 6625 6626 Syntax: `-noround` or `-round ` 6627 6628 By default, **convert3d** will round floating point values when converting 6629 to an integer, short or byte image. This command specifies that rounding 6630 should not be used. Rounding is used to avoid numerical errors stemming from 6631 the internal floating point representation. 6632 6633 c3d image1.img -type short -noround image2.img. 6634 """ 6635 round_: str 6636 """-noround, -round: Floating point rounding behavior 6637 6638 Syntax: `-noround` or `-round ` 6639 6640 By default, **convert3d** will round floating point values when converting 6641 to an integer, short or byte image. This command specifies that rounding 6642 should not be used. Rounding is used to avoid numerical errors stemming from 6643 the internal floating point representation. 6644 6645 c3d image1.img -type short -noround image2.img""" 6646 6647 def run( 6648 self, 6649 execution: Execution, 6650 ) -> list[str]: 6651 """ 6652 Build command line arguments. This method is called by the main command. 6653 6654 Args: 6655 execution: The execution object. 6656 Returns: 6657 Command line arguments 6658 """ 6659 cargs = [] 6660 cargs.extend([ 6661 "-round", 6662 self.round_ 6663 ]) 6664 return cargs 6665 6666 6667@dataclasses.dataclass 6668class C3dScale: 6669 """ 6670 -scale: Scale intensity by constant factor 6671 6672 Syntax: `-scale <factor>` 6673 6674 Multiplies the intensity of each voxel in the last image on the stack by the 6675 given factor. 6676 6677 c3d img1.img -scale 0.5 -o img2.img. 6678 """ 6679 scale: str 6680 """-scale: Scale intensity by constant factor 6681 6682 Syntax: `-scale <factor>` 6683 6684 Multiplies the intensity of each voxel in the last image on the stack by the 6685 given factor. 6686 6687 c3d img1.img -scale 0.5 -o img2.img""" 6688 6689 def run( 6690 self, 6691 execution: Execution, 6692 ) -> list[str]: 6693 """ 6694 Build command line arguments. This method is called by the main command. 6695 6696 Args: 6697 execution: The execution object. 6698 Returns: 6699 Command line arguments 6700 """ 6701 cargs = [] 6702 cargs.extend([ 6703 "-scale", 6704 self.scale 6705 ]) 6706 return cargs 6707 6708 6709@dataclasses.dataclass 6710class C3dSetSform_: 6711 """ 6712 -set-sform: Set the transform to physical space 6713 6714 Syntax: `-set-sform <sform.mat> ` 6715 6716 Sets the Nifti sform of the last image on the stack to the 4x4 matrix 6717 provided. 6718 """ 6719 set_sform: str 6720 """-set-sform: Set the transform to physical space 6721 6722 Syntax: `-set-sform <sform.mat> ` 6723 6724 Sets the Nifti sform of the last image on the stack to the 4x4 matrix 6725 provided.""" 6726 6727 def run( 6728 self, 6729 execution: Execution, 6730 ) -> list[str]: 6731 """ 6732 Build command line arguments. This method is called by the main command. 6733 6734 Args: 6735 execution: The execution object. 6736 Returns: 6737 Command line arguments 6738 """ 6739 cargs = [] 6740 cargs.extend([ 6741 "-set-sform", 6742 self.set_sform 6743 ]) 6744 return cargs 6745 6746 6747@dataclasses.dataclass 6748class C3dSin: 6749 """ 6750 -cos: Voxelwise cosine 6751 6752 Syntax: `-sin` 6753 6754 Replaces the last image on the stack with the cosine trigonometric operation 6755 applied to all voxels. Input must be in radians. 6756 """ 6757 sin: str 6758 """-cos: Voxelwise cosine 6759 6760 Syntax: `-sin` 6761 6762 Replaces the last image on the stack with the cosine trigonometric operation 6763 applied to all voxels. Input must be in radians.""" 6764 6765 def run( 6766 self, 6767 execution: Execution, 6768 ) -> list[str]: 6769 """ 6770 Build command line arguments. This method is called by the main command. 6771 6772 Args: 6773 execution: The execution object. 6774 Returns: 6775 Command line arguments 6776 """ 6777 cargs = [] 6778 cargs.extend([ 6779 "-sin", 6780 self.sin 6781 ]) 6782 return cargs 6783 6784 6785@dataclasses.dataclass 6786class C3dSlice: 6787 """ 6788 -slice: Extract slices from an image 6789 6790 Syntax: `-slice axis position_spec` 6791 6792 Extracts a slice along the specified axis (x,y or z). The position specifier 6793 **position_spec** can be a single slice or a range of slices. For a single 6794 slice, it can be specified as a number or a percentage. Numbering is 6795 zero-based, i.e, the first slice is slice 0, the last slice is N-1, where N 6796 is the number of slices. For a range, use MATLAB notation first:step:last. 6797 The slice is placed on the stack as an image with size 1 in the last 6798 dimension. You can save the slice as a 2D PNG image. 6799 6800 c3d input.img -slice x 128 -o myslice.nii.gz 6801 c3d input.img -slice y 50% myslice.nii.gz 6802 c3d input.img -slice z 25% -type uchar -stretch 0 2000 0 255 -o myslice.png 6803 c3d input.img -slice z 0:-1 -oo slice%0d.nii.gz 6804 c3d input.img -slice z 20%:10%:80% -oo slice%0d.nii.gz 6805 6806 With the new command **c4d**, the **-slice** command can be used to extract 6807 volumes from a 4D image. This can be useful to reformat a 4D NIFTI image as 6808 a 3D multi-component NIFTI image, using the command 6809 6810 c4d input4d.nii.gz -slice w 0:-1 -omc output3d_multicomp.nii.gz. 6811 """ 6812 slice_: str 6813 """-slice: Extract slices from an image 6814 6815 Syntax: `-slice axis position_spec` 6816 6817 Extracts a slice along the specified axis (x,y or z). The position specifier 6818 **position_spec** can be a single slice or a range of slices. For a single 6819 slice, it can be specified as a number or a percentage. Numbering is 6820 zero-based, i.e, the first slice is slice 0, the last slice is N-1, where N 6821 is the number of slices. For a range, use MATLAB notation first:step:last. 6822 The slice is placed on the stack as an image with size 1 in the last 6823 dimension. You can save the slice as a 2D PNG image. 6824 6825 c3d input.img -slice x 128 -o myslice.nii.gz 6826 c3d input.img -slice y 50% myslice.nii.gz 6827 c3d input.img -slice z 25% -type uchar -stretch 0 2000 0 255 -o myslice.png 6828 c3d input.img -slice z 0:-1 -oo slice%0d.nii.gz 6829 c3d input.img -slice z 20%:10%:80% -oo slice%0d.nii.gz 6830 6831 With the new command **c4d**, the **-slice** command can be used to extract 6832 volumes from a 4D image. This can be useful to reformat a 4D NIFTI image as 6833 a 3D multi-component NIFTI image, using the command 6834 6835 c4d input4d.nii.gz -slice w 0:-1 -omc output3d_multicomp.nii.gz""" 6836 6837 def run( 6838 self, 6839 execution: Execution, 6840 ) -> list[str]: 6841 """ 6842 Build command line arguments. This method is called by the main command. 6843 6844 Args: 6845 execution: The execution object. 6846 Returns: 6847 Command line arguments 6848 """ 6849 cargs = [] 6850 cargs.extend([ 6851 "-slice", 6852 self.slice_ 6853 ]) 6854 return cargs 6855 6856 6857@dataclasses.dataclass 6858class C3dSliceAll: 6859 """ 6860 -slice-all: Extract slices from all images on the stack 6861 6862 Syntax `-slice-all axis position_spec` 6863 6864 This command behaves identical to the **-slice** command, but all images on 6865 the stack are sliced, and the slices are interleaved. This is useful for 6866 slicing multi-component images. For example, if you read a four-component 6867 image 'test4.nii.gz', you can extract and save the slices as follows: 6868 6869 c3d test4.nii.gz -slice-all 20%:10%:80% -oomc 4 slice4_%03d.nii.gz. 6870 """ 6871 slice_all: str 6872 """-slice-all: Extract slices from all images on the stack 6873 6874 Syntax `-slice-all axis position_spec` 6875 6876 This command behaves identical to the **-slice** command, but all images on 6877 the stack are sliced, and the slices are interleaved. This is useful for 6878 slicing multi-component images. For example, if you read a four-component 6879 image 'test4.nii.gz', you can extract and save the slices as follows: 6880 6881 c3d test4.nii.gz -slice-all 20%:10%:80% -oomc 4 slice4_%03d.nii.gz""" 6882 6883 def run( 6884 self, 6885 execution: Execution, 6886 ) -> list[str]: 6887 """ 6888 Build command line arguments. This method is called by the main command. 6889 6890 Args: 6891 execution: The execution object. 6892 Returns: 6893 Command line arguments 6894 """ 6895 cargs = [] 6896 cargs.extend([ 6897 "-slice-all", 6898 self.slice_all 6899 ]) 6900 return cargs 6901 6902 6903@dataclasses.dataclass 6904class C3dSharpen: 6905 """ 6906 -sharpen: Sharpen edges in the image 6907 6908 Syntax: `-sharpen` 6909 6910 Applies the Laplacian sharpening filter from ITK, which accentuates the 6911 edges in the image. 6912 6913 c3d input.nii.gz -sharpen -o output.nii.gz. 6914 """ 6915 sharpen: str 6916 """-sharpen: Sharpen edges in the image 6917 6918 Syntax: `-sharpen` 6919 6920 Applies the Laplacian sharpening filter from ITK, which accentuates the 6921 edges in the image. 6922 6923 c3d input.nii.gz -sharpen -o output.nii.gz""" 6924 6925 def run( 6926 self, 6927 execution: Execution, 6928 ) -> list[str]: 6929 """ 6930 Build command line arguments. This method is called by the main command. 6931 6932 Args: 6933 execution: The execution object. 6934 Returns: 6935 Command line arguments 6936 """ 6937 cargs = [] 6938 cargs.extend([ 6939 "-sharpen", 6940 self.sharpen 6941 ]) 6942 return cargs 6943 6944 6945@dataclasses.dataclass 6946class C3dShift: 6947 """ 6948 -shift: Shift image intensity by constant 6949 6950 Syntax: `-shift <constant>` 6951 6952 Adds the given constant to every voxel. 6953 6954 c3d img1.img -shift 100 -o img2.img. 6955 """ 6956 shift: str 6957 """-shift: Shift image intensity by constant 6958 6959 Syntax: `-shift <constant>` 6960 6961 Adds the given constant to every voxel. 6962 6963 c3d img1.img -shift 100 -o img2.img""" 6964 6965 def run( 6966 self, 6967 execution: Execution, 6968 ) -> list[str]: 6969 """ 6970 Build command line arguments. This method is called by the main command. 6971 6972 Args: 6973 execution: The execution object. 6974 Returns: 6975 Command line arguments 6976 """ 6977 cargs = [] 6978 cargs.extend([ 6979 "-shift", 6980 self.shift 6981 ]) 6982 return cargs 6983 6984 6985@dataclasses.dataclass 6986class C3dSignedDistanceTransform: 6987 """ 6988 -sdt, -signed-distance-transform: Signed distance transform of a binary 6989 image 6990 6991 Syntax: `-sdt` 6992 6993 Computes the signed distance transform of a binary image. Voxels where the 6994 binary image is non-zero will have negative values and voxels where the 6995 binary image is zero will have negative values. The magnitude of the value 6996 will be the approximate Euclidean distance to the boundary of the object 6997 represented by the binary image. 6998 6999 c3d binary.img -sdt -o dist.img. 7000 """ 7001 signed_distance_transform: str 7002 """-sdt, -signed-distance-transform: Signed distance transform of a binary 7003 image 7004 7005 Syntax: `-sdt` 7006 7007 Computes the signed distance transform of a binary image. Voxels where the 7008 binary image is non-zero will have negative values and voxels where the 7009 binary image is zero will have negative values. The magnitude of the value 7010 will be the approximate Euclidean distance to the boundary of the object 7011 represented by the binary image. 7012 7013 c3d binary.img -sdt -o dist.img""" 7014 7015 def run( 7016 self, 7017 execution: Execution, 7018 ) -> list[str]: 7019 """ 7020 Build command line arguments. This method is called by the main command. 7021 7022 Args: 7023 execution: The execution object. 7024 Returns: 7025 Command line arguments 7026 """ 7027 cargs = [] 7028 cargs.extend([ 7029 "-signed-distance-transform", 7030 self.signed_distance_transform 7031 ]) 7032 return cargs 7033 7034 7035@dataclasses.dataclass 7036class C3dSmooth: 7037 """ 7038 -smooth: Gaussian smoothing 7039 7040 Syntax: `-smooth <sigma_vector> ` 7041 7042 Applies Gaussian smoothing to the image. The parameter vector specifies the 7043 standard deviation of the Gaussian kernel. Also see [Vector Format 7044 Specification][10] below. 7045 7046 c3d img1.img -smooth 2x1x1vox -o out.img. 7047 """ 7048 smooth: str 7049 """-smooth: Gaussian smoothing 7050 7051 Syntax: `-smooth <sigma_vector> ` 7052 7053 Applies Gaussian smoothing to the image. The parameter vector specifies the 7054 standard deviation of the Gaussian kernel. Also see [Vector Format 7055 Specification][10] below. 7056 7057 c3d img1.img -smooth 2x1x1vox -o out.img""" 7058 7059 def run( 7060 self, 7061 execution: Execution, 7062 ) -> list[str]: 7063 """ 7064 Build command line arguments. This method is called by the main command. 7065 7066 Args: 7067 execution: The execution object. 7068 Returns: 7069 Command line arguments 7070 """ 7071 cargs = [] 7072 cargs.extend([ 7073 "-smooth", 7074 self.smooth 7075 ]) 7076 return cargs 7077 7078 7079@dataclasses.dataclass 7080class C3dSmoothFast: 7081 """ 7082 -smooth-fast: Fast approximate Gaussian smoothing 7083 7084 Syntax: `-smooth-fast <sigma_vector> ` 7085 7086 Applies Gaussian smoothing to the image using the fast [Deriche recursive 7087 smoothing algorithm][15]. The parameter vector specifies the standard 7088 deviation of the Gaussian kernel. Also see [Vector Format Specification][10] 7089 below. 7090 7091 c3d img1.img -smooth-fast 20x10x10vox -o out.img. 7092 """ 7093 smooth_fast: str 7094 """-smooth-fast: Fast approximate Gaussian smoothing 7095 7096 Syntax: `-smooth-fast <sigma_vector> ` 7097 7098 Applies Gaussian smoothing to the image using the fast [Deriche recursive 7099 smoothing algorithm][15]. The parameter vector specifies the standard 7100 deviation of the Gaussian kernel. Also see [Vector Format Specification][10] 7101 below. 7102 7103 c3d img1.img -smooth-fast 20x10x10vox -o out.img""" 7104 7105 def run( 7106 self, 7107 execution: Execution, 7108 ) -> list[str]: 7109 """ 7110 Build command line arguments. This method is called by the main command. 7111 7112 Args: 7113 execution: The execution object. 7114 Returns: 7115 Command line arguments 7116 """ 7117 cargs = [] 7118 cargs.extend([ 7119 "-smooth-fast", 7120 self.smooth_fast 7121 ]) 7122 return cargs 7123 7124 7125@dataclasses.dataclass 7126class C3dSpacing: 7127 """ 7128 -spacing: Set voxel spacing 7129 7130 Syntax: `-spacing <vector> ` 7131 7132 Sets the voxel spacing of the image. This should always be a vector with 7133 positive components. For example, to set the spacing of the image to 1mm 7134 isotropic, use the command below. This command only changes the header of 7135 the image, not its contents. 7136 7137 c3d img.nii -spacing 1x1x1mm -o out.img. 7138 """ 7139 spacing: str 7140 """-spacing: Set voxel spacing 7141 7142 Syntax: `-spacing <vector> ` 7143 7144 Sets the voxel spacing of the image. This should always be a vector with 7145 positive components. For example, to set the spacing of the image to 1mm 7146 isotropic, use the command below. This command only changes the header of 7147 the image, not its contents. 7148 7149 c3d img.nii -spacing 1x1x1mm -o out.img""" 7150 7151 def run( 7152 self, 7153 execution: Execution, 7154 ) -> list[str]: 7155 """ 7156 Build command line arguments. This method is called by the main command. 7157 7158 Args: 7159 execution: The execution object. 7160 Returns: 7161 Command line arguments 7162 """ 7163 cargs = [] 7164 cargs.extend([ 7165 "-spacing", 7166 self.spacing 7167 ]) 7168 return cargs 7169 7170 7171@dataclasses.dataclass 7172class C3dSplit: 7173 """ 7174 -split: Split multi-label image into binary images 7175 7176 Syntax: `-split` 7177 7178 This command takes a multilabel image (one with a small number of discrete 7179 intensity levels), and replaces it with a set of binary images, one for each 7180 of the levels. The images can later be recombined using the **-merge** 7181 command. The labels corresponding to each binary image are remembered by 7182 **convert3d** so that when **-merge** is called, the labels are faithfully 7183 reassigned. The **-merge** command treats each input as a probability image, 7184 and selects at each voxel the label that has highest probability. The 7185 example below smooths each label independently, then recombines using 7186 **-merge** 7187 7188 c3d multilabel.nii -split -foreach -smooth 3mm -endfor -merge -o 7189 ml_smooth.nii 7190 7191 Also of note is that the **-split** command will disregard infinite 7192 intensity values. So if you want to apply voting to a subset of the labels, 7193 you can replace labels you do not care about with *inf*, for example, using 7194 the **-thresh** command. 7195 """ 7196 split: str 7197 """-split: Split multi-label image into binary images 7198 7199 Syntax: `-split` 7200 7201 This command takes a multilabel image (one with a small number of discrete 7202 intensity levels), and replaces it with a set of binary images, one for each 7203 of the levels. The images can later be recombined using the **-merge** 7204 command. The labels corresponding to each binary image are remembered by 7205 **convert3d** so that when **-merge** is called, the labels are faithfully 7206 reassigned. The **-merge** command treats each input as a probability image, 7207 and selects at each voxel the label that has highest probability. The 7208 example below smooths each label independently, then recombines using 7209 **-merge** 7210 7211 c3d multilabel.nii -split -foreach -smooth 3mm -endfor -merge -o 7212 ml_smooth.nii 7213 7214 Also of note is that the **-split** command will disregard infinite 7215 intensity values. So if you want to apply voting to a subset of the labels, 7216 you can replace labels you do not care about with *inf*, for example, using 7217 the **-thresh** command.""" 7218 7219 def run( 7220 self, 7221 execution: Execution, 7222 ) -> list[str]: 7223 """ 7224 Build command line arguments. This method is called by the main command. 7225 7226 Args: 7227 execution: The execution object. 7228 Returns: 7229 Command line arguments 7230 """ 7231 cargs = [] 7232 cargs.extend([ 7233 "-split", 7234 self.split 7235 ]) 7236 return cargs 7237 7238 7239@dataclasses.dataclass 7240class C3dSqrt: 7241 """ 7242 -sqrt: Take square root of image 7243 7244 Syntax: `-sqrt ` 7245 7246 Computes square root of each voxel in the image. 7247 7248 c3d input.img -sqrt -o output.img. 7249 """ 7250 sqrt: str 7251 """-sqrt: Take square root of image 7252 7253 Syntax: `-sqrt ` 7254 7255 Computes square root of each voxel in the image. 7256 7257 c3d input.img -sqrt -o output.img""" 7258 7259 def run( 7260 self, 7261 execution: Execution, 7262 ) -> list[str]: 7263 """ 7264 Build command line arguments. This method is called by the main command. 7265 7266 Args: 7267 execution: The execution object. 7268 Returns: 7269 Command line arguments 7270 """ 7271 cargs = [] 7272 cargs.extend([ 7273 "-sqrt", 7274 self.sqrt 7275 ]) 7276 return cargs 7277 7278 7279@dataclasses.dataclass 7280class C3dStaple: 7281 """ 7282 -staple: STAPLE algorithm to combine segmentations 7283 7284 Syntax: `-staple <intensity_value> ` 7285 7286 Runs the ITK implementation of the STAPLE algorithm ([See Paper][11]). 7287 STAPLE generates an estimate of the 'true' segmentation of a structure given 7288 a set of segmentations by different raters. This command treats all images 7289 on the stack as inputs. Each image is considered to be a segmentation by a 7290 different rater. The parameter *intensity_value* specifies the label in the 7291 segmentation images corresponding to the structure of interest (e.g., the 7292 segmentation image may have value 1 corresponding to the caudate and value 2 7293 corresponding to the hippocampus. To run STAPLE on the hippocampus, pass in 7294 2 as the *intensity_value*). The output of STAPLE is a real-valued image 7295 with voxels between 0 and 1, representing the probability of each voxel 7296 being in the 'true' segmentation. This image can be thresholded to get a 7297 binary consensus segmentation. Additional outputs (estimates of the 7298 sensitivity and specificity of each rater) are printed out if the 7299 **-verbose** command is used before the **-staple** command. 7300 7301 c3d -verbose rater1.img rater2.img rater3.img -staple 1 -o probmap.img 7302 c3d -verbose rater*.img -staple 1 -threshold 0.5 inf 1 0 -o bin_segm.img. 7303 """ 7304 staple: str 7305 """-staple: STAPLE algorithm to combine segmentations 7306 7307 Syntax: `-staple <intensity_value> ` 7308 7309 Runs the ITK implementation of the STAPLE algorithm ([See Paper][11]). 7310 STAPLE generates an estimate of the 'true' segmentation of a structure given 7311 a set of segmentations by different raters. This command treats all images 7312 on the stack as inputs. Each image is considered to be a segmentation by a 7313 different rater. The parameter *intensity_value* specifies the label in the 7314 segmentation images corresponding to the structure of interest (e.g., the 7315 segmentation image may have value 1 corresponding to the caudate and value 2 7316 corresponding to the hippocampus. To run STAPLE on the hippocampus, pass in 7317 2 as the *intensity_value*). The output of STAPLE is a real-valued image 7318 with voxels between 0 and 1, representing the probability of each voxel 7319 being in the 'true' segmentation. This image can be thresholded to get a 7320 binary consensus segmentation. Additional outputs (estimates of the 7321 sensitivity and specificity of each rater) are printed out if the 7322 **-verbose** command is used before the **-staple** command. 7323 7324 c3d -verbose rater1.img rater2.img rater3.img -staple 1 -o probmap.img 7325 c3d -verbose rater*.img -staple 1 -threshold 0.5 inf 1 0 -o bin_segm.img""" 7326 7327 def run( 7328 self, 7329 execution: Execution, 7330 ) -> list[str]: 7331 """ 7332 Build command line arguments. This method is called by the main command. 7333 7334 Args: 7335 execution: The execution object. 7336 Returns: 7337 Command line arguments 7338 """ 7339 cargs = [] 7340 cargs.extend([ 7341 "-staple", 7342 self.staple 7343 ]) 7344 return cargs 7345 7346 7347@dataclasses.dataclass 7348class C3dStructureTensorEigenvalues: 7349 """ 7350 -steig, -structure-tensor-eigenvalues: Compute eigenvalues of the structure 7351 tensor 7352 7353 Syntax `-steig <scale> <radius>` 7354 7355 Computes the Hessian matrix at every pixel of an image and the eigenvalues 7356 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 7357 the stack. These images are useful as texture features. See also the 7358 '''-steig''' command. The scale determines the amount of Gaussian smoothing 7359 applied for computing the partial derivatives in the Hessian, and is in 7360 physical (mm) units. 7361 7362 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz. 7363 """ 7364 structure_tensor_eigenvalues: str 7365 """-steig, -structure-tensor-eigenvalues: Compute eigenvalues of the 7366 structure tensor 7367 7368 Syntax `-steig <scale> <radius>` 7369 7370 Computes the Hessian matrix at every pixel of an image and the eigenvalues 7371 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 7372 the stack. These images are useful as texture features. See also the 7373 '''-steig''' command. The scale determines the amount of Gaussian smoothing 7374 applied for computing the partial derivatives in the Hessian, and is in 7375 physical (mm) units. 7376 7377 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz""" 7378 7379 def run( 7380 self, 7381 execution: Execution, 7382 ) -> list[str]: 7383 """ 7384 Build command line arguments. This method is called by the main command. 7385 7386 Args: 7387 execution: The execution object. 7388 Returns: 7389 Command line arguments 7390 """ 7391 cargs = [] 7392 cargs.extend([ 7393 "-steig", 7394 self.structure_tensor_eigenvalues 7395 ]) 7396 return cargs 7397 7398 7399@dataclasses.dataclass 7400class C3dSpm: 7401 """ 7402 -spm, -nospm: SPM compatibility in Analyze output 7403 7404 Syntax: `-spm` or `-nospm ` 7405 7406 These options specify whether use the SPM extension to the Analyze 7407 (.hdr,.img) format. When this option is on, the origin field stored by SPM 7408 in the Analyze header will be correctly interpreted. When saving analyze 7409 files, the origin will be set correctly. The default is equivalent to the 7410 **-nospm** option. Best to avoid this issue altogether by using NIFTI and 7411 SPM5 or later. 7412 7413 c3d -spm in.hdr out.img.gz. 7414 """ 7415 spm: str 7416 """-spm, -nospm: SPM compatibility in Analyze output 7417 7418 Syntax: `-spm` or `-nospm ` 7419 7420 These options specify whether use the SPM extension to the Analyze 7421 (.hdr,.img) format. When this option is on, the origin field stored by SPM 7422 in the Analyze header will be correctly interpreted. When saving analyze 7423 files, the origin will be set correctly. The default is equivalent to the 7424 **-nospm** option. Best to avoid this issue altogether by using NIFTI and 7425 SPM5 or later. 7426 7427 c3d -spm in.hdr out.img.gz""" 7428 7429 def run( 7430 self, 7431 execution: Execution, 7432 ) -> list[str]: 7433 """ 7434 Build command line arguments. This method is called by the main command. 7435 7436 Args: 7437 execution: The execution object. 7438 Returns: 7439 Command line arguments 7440 """ 7441 cargs = [] 7442 cargs.extend([ 7443 "-spm", 7444 self.spm 7445 ]) 7446 return cargs 7447 7448 7449@dataclasses.dataclass 7450class C3dSubtract: 7451 """ 7452 No description found. 7453 """ 7454 subtract: str 7455 """No description found.""" 7456 7457 def run( 7458 self, 7459 execution: Execution, 7460 ) -> list[str]: 7461 """ 7462 Build command line arguments. This method is called by the main command. 7463 7464 Args: 7465 execution: The execution object. 7466 Returns: 7467 Command line arguments 7468 """ 7469 cargs = [] 7470 cargs.extend([ 7471 "-subtract", 7472 self.subtract 7473 ]) 7474 return cargs 7475 7476 7477@dataclasses.dataclass 7478class C3dSupervoxel: 7479 """ 7480 No description found. 7481 """ 7482 supervoxel: str 7483 """No description found.""" 7484 7485 def run( 7486 self, 7487 execution: Execution, 7488 ) -> list[str]: 7489 """ 7490 Build command line arguments. This method is called by the main command. 7491 7492 Args: 7493 execution: The execution object. 7494 Returns: 7495 Command line arguments 7496 """ 7497 cargs = [] 7498 cargs.extend([ 7499 "-supervoxel", 7500 self.supervoxel 7501 ]) 7502 return cargs 7503 7504 7505@dataclasses.dataclass 7506class C3dStretch: 7507 """ 7508 -stretch: Stretch image intensities linearly 7509 7510 Syntax: `-stretch <u1 u2 v1 v2> ` 7511 7512 Stretches the intensities in the image linearly, such that u1 maps to v1 and 7513 u2 maps to v2. The linear transformation is applied to all intensities in 7514 the image, whether inside the range or not. For example, to map a floating 7515 point image with intensities in interval (0,1) to the full range of an 7516 unsigned short image, use 7517 7518 c3d input.img -stretch 0.0 1.0 0 65535 -type ushort -o output.img. 7519 """ 7520 stretch: str 7521 """-stretch: Stretch image intensities linearly 7522 7523 Syntax: `-stretch <u1 u2 v1 v2> ` 7524 7525 Stretches the intensities in the image linearly, such that u1 maps to v1 and 7526 u2 maps to v2. The linear transformation is applied to all intensities in 7527 the image, whether inside the range or not. For example, to map a floating 7528 point image with intensities in interval (0,1) to the full range of an 7529 unsigned short image, use 7530 7531 c3d input.img -stretch 0.0 1.0 0 65535 -type ushort -o output.img""" 7532 7533 def run( 7534 self, 7535 execution: Execution, 7536 ) -> list[str]: 7537 """ 7538 Build command line arguments. This method is called by the main command. 7539 7540 Args: 7541 execution: The execution object. 7542 Returns: 7543 Command line arguments 7544 """ 7545 cargs = [] 7546 cargs.extend([ 7547 "-stretch", 7548 self.stretch 7549 ]) 7550 return cargs 7551 7552 7553@dataclasses.dataclass 7554class C3dSwapdim: 7555 """ 7556 -swapdim: Reorder the coordinate axes of an image 7557 7558 Syntax `-swapdim <code>` 7559 7560 This command reorders the image axes (columns, rows, slices) to achieve a 7561 desired transformation between voxel space and physical space. The image 7562 remains exactly the same in physical space, but the encoding of the voxels 7563 in memory and on disk is changed to obtain the desired transformation. The 7564 transformation is specified as a three-letter 'RAI' code, as in the 7565 '''-orient''' command. 7566 7567 c3d img.nii -swapdim ASL -info -o out.nii 7568 7569 7570 ### Commands: Image Processing 7571 7572 The following commands invoke an action that is applied to images. Unary 7573 commands apply the action to the last image on the stack, binary commands 7574 apply to the last two images and so on. Commands are affected by options, 7575 which are listed separately. 7576 """ 7577 swapdim: str 7578 """-swapdim: Reorder the coordinate axes of an image 7579 7580 Syntax `-swapdim <code>` 7581 7582 This command reorders the image axes (columns, rows, slices) to achieve a 7583 desired transformation between voxel space and physical space. The image 7584 remains exactly the same in physical space, but the encoding of the voxels 7585 in memory and on disk is changed to obtain the desired transformation. The 7586 transformation is specified as a three-letter 'RAI' code, as in the 7587 '''-orient''' command. 7588 7589 c3d img.nii -swapdim ASL -info -o out.nii 7590 7591 7592 ### Commands: Image Processing 7593 7594 The following commands invoke an action that is applied to images. Unary 7595 commands apply the action to the last image on the stack, binary commands 7596 apply to the last two images and so on. Commands are affected by options, 7597 which are listed separately.""" 7598 7599 def run( 7600 self, 7601 execution: Execution, 7602 ) -> list[str]: 7603 """ 7604 Build command line arguments. This method is called by the main command. 7605 7606 Args: 7607 execution: The execution object. 7608 Returns: 7609 Command line arguments 7610 """ 7611 cargs = [] 7612 cargs.extend([ 7613 "-swapdim", 7614 self.swapdim 7615 ]) 7616 return cargs 7617 7618 7619@dataclasses.dataclass 7620class C3dTestImage: 7621 """ 7622 -test-image, -test-probe: Test condition 7623 7624 Syntax: `-test-image [tolerance]` and `-test-probe <vector> <value> 7625 [tolerance]` 7626 7627 These advanced commands (with more to come in the future) are primarily 7628 meant to allow testing of **c3d**. However, they can also be used for flow 7629 control in shell scripts (e.g., **bash** shell). The commands check a 7630 certain aspect of the **c3d** state and cause the program to exit with 7631 either return code 0 if the test succeeded or a non-zero return code if the 7632 test failed. 7633 7634 **-test-image** tests if the last two images on the stack are identical 7635 (both in terms of data and header). Returns 0 if the images are identical. 7636 The optional tolerance parameter has default value 1e-8. 7637 7638 c3d input1.img input2.img -test-image 7639 7640 **-test-probe** is similar to the **-probe** command. It tests if the value 7641 of the last image on the stack at the position given by **vector** is equal 7642 to the **test_value**. An optional tolerance value may be specified, the 7643 default is 1e-8. 7644 7645 c3d input1.img -test-probe 40x40x20vox 1.0 1e-6. 7646 """ 7647 test_image: str 7648 """-test-image, -test-probe: Test condition 7649 7650 Syntax: `-test-image [tolerance]` and `-test-probe <vector> <value> 7651 [tolerance]` 7652 7653 These advanced commands (with more to come in the future) are primarily 7654 meant to allow testing of **c3d**. However, they can also be used for flow 7655 control in shell scripts (e.g., **bash** shell). The commands check a 7656 certain aspect of the **c3d** state and cause the program to exit with 7657 either return code 0 if the test succeeded or a non-zero return code if the 7658 test failed. 7659 7660 **-test-image** tests if the last two images on the stack are identical 7661 (both in terms of data and header). Returns 0 if the images are identical. 7662 The optional tolerance parameter has default value 1e-8. 7663 7664 c3d input1.img input2.img -test-image 7665 7666 **-test-probe** is similar to the **-probe** command. It tests if the value 7667 of the last image on the stack at the position given by **vector** is equal 7668 to the **test_value**. An optional tolerance value may be specified, the 7669 default is 1e-8. 7670 7671 c3d input1.img -test-probe 40x40x20vox 1.0 1e-6""" 7672 7673 def run( 7674 self, 7675 execution: Execution, 7676 ) -> list[str]: 7677 """ 7678 Build command line arguments. This method is called by the main command. 7679 7680 Args: 7681 execution: The execution object. 7682 Returns: 7683 Command line arguments 7684 """ 7685 cargs = [] 7686 cargs.extend([ 7687 "-test-image", 7688 self.test_image 7689 ]) 7690 return cargs 7691 7692 7693@dataclasses.dataclass 7694class C3dTestProbe: 7695 """ 7696 -test-image, -test-probe: Test condition 7697 7698 Syntax: `-test-image [tolerance]` and `-test-probe <vector> <value> 7699 [tolerance]` 7700 7701 These advanced commands (with more to come in the future) are primarily 7702 meant to allow testing of **c3d**. However, they can also be used for flow 7703 control in shell scripts (e.g., **bash** shell). The commands check a 7704 certain aspect of the **c3d** state and cause the program to exit with 7705 either return code 0 if the test succeeded or a non-zero return code if the 7706 test failed. 7707 7708 **-test-image** tests if the last two images on the stack are identical 7709 (both in terms of data and header). Returns 0 if the images are identical. 7710 The optional tolerance parameter has default value 1e-8. 7711 7712 c3d input1.img input2.img -test-image 7713 7714 **-test-probe** is similar to the **-probe** command. It tests if the value 7715 of the last image on the stack at the position given by **vector** is equal 7716 to the **test_value**. An optional tolerance value may be specified, the 7717 default is 1e-8. 7718 7719 c3d input1.img -test-probe 40x40x20vox 1.0 1e-6. 7720 """ 7721 test_probe: str 7722 """-test-image, -test-probe: Test condition 7723 7724 Syntax: `-test-image [tolerance]` and `-test-probe <vector> <value> 7725 [tolerance]` 7726 7727 These advanced commands (with more to come in the future) are primarily 7728 meant to allow testing of **c3d**. However, they can also be used for flow 7729 control in shell scripts (e.g., **bash** shell). The commands check a 7730 certain aspect of the **c3d** state and cause the program to exit with 7731 either return code 0 if the test succeeded or a non-zero return code if the 7732 test failed. 7733 7734 **-test-image** tests if the last two images on the stack are identical 7735 (both in terms of data and header). Returns 0 if the images are identical. 7736 The optional tolerance parameter has default value 1e-8. 7737 7738 c3d input1.img input2.img -test-image 7739 7740 **-test-probe** is similar to the **-probe** command. It tests if the value 7741 of the last image on the stack at the position given by **vector** is equal 7742 to the **test_value**. An optional tolerance value may be specified, the 7743 default is 1e-8. 7744 7745 c3d input1.img -test-probe 40x40x20vox 1.0 1e-6""" 7746 7747 def run( 7748 self, 7749 execution: Execution, 7750 ) -> list[str]: 7751 """ 7752 Build command line arguments. This method is called by the main command. 7753 7754 Args: 7755 execution: The execution object. 7756 Returns: 7757 Command line arguments 7758 """ 7759 cargs = [] 7760 cargs.extend([ 7761 "-test-probe", 7762 self.test_probe 7763 ]) 7764 return cargs 7765 7766 7767@dataclasses.dataclass 7768class C3dThreshold: 7769 """ 7770 -thresh, -threshold: Binary thresholding 7771 7772 Syntax: `-thresh <u1 u2 vIn vOut> ` 7773 7774 Thresholds the image, setting voxels whose intensity is in the range [u1,u2] 7775 to vIn and all other voxels to vOut. Values *u1* and *u2* are intensity 7776 specifications (see below). This means that you can supply values **inf** 7777 and **-inf** for u1 and u2 to construct a one-sided threshold. You can also 7778 specify *u1* and *u2* as percentiles. 7779 c3d in.img -threshold -inf 128 1 0 -o out.img 7780 c3d in.img -threshold 64 128 1 0 -o out.img 7781 c3d in.img -threshold 20% 40% 1 0 -o out.img. 7782 """ 7783 threshold: str 7784 """-thresh, -threshold: Binary thresholding 7785 7786 Syntax: `-thresh <u1 u2 vIn vOut> ` 7787 7788 Thresholds the image, setting voxels whose intensity is in the range [u1,u2] 7789 to vIn and all other voxels to vOut. Values *u1* and *u2* are intensity 7790 specifications (see below). This means that you can supply values **inf** 7791 and **-inf** for u1 and u2 to construct a one-sided threshold. You can also 7792 specify *u1* and *u2* as percentiles. 7793 c3d in.img -threshold -inf 128 1 0 -o out.img 7794 c3d in.img -threshold 64 128 1 0 -o out.img 7795 c3d in.img -threshold 20% 40% 1 0 -o out.img""" 7796 7797 def run( 7798 self, 7799 execution: Execution, 7800 ) -> list[str]: 7801 """ 7802 Build command line arguments. This method is called by the main command. 7803 7804 Args: 7805 execution: The execution object. 7806 Returns: 7807 Command line arguments 7808 """ 7809 cargs = [] 7810 cargs.extend([ 7811 "-threshold", 7812 self.threshold 7813 ]) 7814 return cargs 7815 7816 7817@dataclasses.dataclass 7818class C3dTile: 7819 """ 7820 -tile: Tile and stack multiple images into one 7821 7822 Syntax: `-tile <tile_spec>` 7823 7824 Tiles multiple images into a single image -- including stacking slices into 7825 a 3D volume. The command takes all images on the stack and produces a single 7826 tiled image. The **tile_spec** parameter can either specify a coordinate 7827 axis (x, y, or z) along which to tile the images, or a layout vector (e.g., 7828 **4x4**) which specifies the tiling along each coordinate. Passing 0 for the 7829 last value in the layout vector determines the value based on the number of 7830 images currently loaded. For example, to create a 3D volume from a set of 7831 slices, we use 7832 7833 c3d slices*.png -tile z -o volume.nii.gz 7834 7835 And to arrange the same 2D slices into a 2D montage of 4 images per row, we 7836 would use the **c2d** command as follows: 7837 7838 c2d slices*.png -tile 4x0 -type uchar -o montage.png. 7839 """ 7840 tile: str 7841 """-tile: Tile and stack multiple images into one 7842 7843 Syntax: `-tile <tile_spec>` 7844 7845 Tiles multiple images into a single image -- including stacking slices into 7846 a 3D volume. The command takes all images on the stack and produces a single 7847 tiled image. The **tile_spec** parameter can either specify a coordinate 7848 axis (x, y, or z) along which to tile the images, or a layout vector (e.g., 7849 **4x4**) which specifies the tiling along each coordinate. Passing 0 for the 7850 last value in the layout vector determines the value based on the number of 7851 images currently loaded. For example, to create a 3D volume from a set of 7852 slices, we use 7853 7854 c3d slices*.png -tile z -o volume.nii.gz 7855 7856 And to arrange the same 2D slices into a 2D montage of 4 images per row, we 7857 would use the **c2d** command as follows: 7858 7859 c2d slices*.png -tile 4x0 -type uchar -o montage.png""" 7860 7861 def run( 7862 self, 7863 execution: Execution, 7864 ) -> list[str]: 7865 """ 7866 Build command line arguments. This method is called by the main command. 7867 7868 Args: 7869 execution: The execution object. 7870 Returns: 7871 Command line arguments 7872 """ 7873 cargs = [] 7874 cargs.extend([ 7875 "-tile", 7876 self.tile 7877 ]) 7878 return cargs 7879 7880 7881@dataclasses.dataclass 7882class C3dTrim: 7883 """ 7884 -trim: Trim background region of image 7885 7886 Syntax: `-trim <margin_vector>` 7887 7888 Use this command to trim background in an image. When most of the image is 7889 filled by background, this command will find the smallest rectangular region 7890 that contains all of the non-background voxels in the image. I will then 7891 expand this region by the margin of the size specified, and return the 7892 resulting region as the new image. For example, this command will trim an 7893 image, leaving a 5-voxel margin of background values on all sides 7894 7895 c3d in.img -trim 5vox -o out.img. 7896 """ 7897 trim: str 7898 """-trim: Trim background region of image 7899 7900 Syntax: `-trim <margin_vector>` 7901 7902 Use this command to trim background in an image. When most of the image is 7903 filled by background, this command will find the smallest rectangular region 7904 that contains all of the non-background voxels in the image. I will then 7905 expand this region by the margin of the size specified, and return the 7906 resulting region as the new image. For example, this command will trim an 7907 image, leaving a 5-voxel margin of background values on all sides 7908 7909 c3d in.img -trim 5vox -o out.img""" 7910 7911 def run( 7912 self, 7913 execution: Execution, 7914 ) -> list[str]: 7915 """ 7916 Build command line arguments. This method is called by the main command. 7917 7918 Args: 7919 execution: The execution object. 7920 Returns: 7921 Command line arguments 7922 """ 7923 cargs = [] 7924 cargs.extend([ 7925 "-trim", 7926 self.trim 7927 ]) 7928 return cargs 7929 7930 7931@dataclasses.dataclass 7932class C3dTrimToSize: 7933 """ 7934 -trim-to-size: Trim image to given size 7935 7936 Syntax: `-trim-to-size <size_vector>` 7937 7938 Like **-trim**, this command trims the background in an image. However, 7939 instead of **-trim**, you specify the target size of the output region. The 7940 actual region may be smaller if the specified region falls outside the 7941 boundaries of the input image. For example, if you want a 64x64x128 image 7942 containing all the foreground pixels in your image, call 7943 7944 c3d in.img -trim-to-size 64x64x128vox -o out.img. 7945 """ 7946 trim_to_size: str 7947 """-trim-to-size: Trim image to given size 7948 7949 Syntax: `-trim-to-size <size_vector>` 7950 7951 Like **-trim**, this command trims the background in an image. However, 7952 instead of **-trim**, you specify the target size of the output region. The 7953 actual region may be smaller if the specified region falls outside the 7954 boundaries of the input image. For example, if you want a 64x64x128 image 7955 containing all the foreground pixels in your image, call 7956 7957 c3d in.img -trim-to-size 64x64x128vox -o out.img""" 7958 7959 def run( 7960 self, 7961 execution: Execution, 7962 ) -> list[str]: 7963 """ 7964 Build command line arguments. This method is called by the main command. 7965 7966 Args: 7967 execution: The execution object. 7968 Returns: 7969 Command line arguments 7970 """ 7971 cargs = [] 7972 cargs.extend([ 7973 "-trim-to-size", 7974 self.trim_to_size 7975 ]) 7976 return cargs 7977 7978 7979@dataclasses.dataclass 7980class C3dType: 7981 """ 7982 -type: Specify pixel type for image output 7983 7984 Syntax: `-type < char | uchar | short | ushort | int | uint | float | double 7985 > ` 7986 7987 Specifies the pixel type for the output image. By default, images are 7988 written in floating point (**float**) format. The type does not affect how 7989 images are processed, only how they are saved. 7990 7991 c3d image1.img -type short image2.img 7992 7993 Some images require data in certain types. For example, to save PNG images, 7994 uchar or ushort type must be specified. 7995 """ 7996 type_: str 7997 """-type: Specify pixel type for image output 7998 7999 Syntax: `-type < char | uchar | short | ushort | int | uint | float | double 8000 > ` 8001 8002 Specifies the pixel type for the output image. By default, images are 8003 written in floating point (**float**) format. The type does not affect how 8004 images are processed, only how they are saved. 8005 8006 c3d image1.img -type short image2.img 8007 8008 Some images require data in certain types. For example, to save PNG images, 8009 uchar or ushort type must be specified.""" 8010 8011 def run( 8012 self, 8013 execution: Execution, 8014 ) -> list[str]: 8015 """ 8016 Build command line arguments. This method is called by the main command. 8017 8018 Args: 8019 execution: The execution object. 8020 Returns: 8021 Command line arguments 8022 """ 8023 cargs = [] 8024 cargs.extend([ 8025 "-type", 8026 self.type_ 8027 ]) 8028 return cargs 8029 8030 8031@dataclasses.dataclass 8032class C3dVerbose: 8033 """ 8034 -verbose: Enable verbose output of commands 8035 8036 Syntax: `-verbose` 8037 8038 Commands entered after the **-verbose** command will print debugging 8039 information. This can be turned off with **-noverbose**. 8040 8041 ### Parameter Specifications. 8042 """ 8043 verbose: str 8044 """-verbose: Enable verbose output of commands 8045 8046 Syntax: `-verbose` 8047 8048 Commands entered after the **-verbose** command will print debugging 8049 information. This can be turned off with **-noverbose**. 8050 8051 ### Parameter Specifications""" 8052 8053 def run( 8054 self, 8055 execution: Execution, 8056 ) -> list[str]: 8057 """ 8058 Build command line arguments. This method is called by the main command. 8059 8060 Args: 8061 execution: The execution object. 8062 Returns: 8063 Command line arguments 8064 """ 8065 cargs = [] 8066 cargs.extend([ 8067 "-verbose", 8068 self.verbose 8069 ]) 8070 return cargs 8071 8072 8073@dataclasses.dataclass 8074class C3dNoverbose: 8075 """ 8076 No description found. 8077 """ 8078 noverbose: str 8079 """No description found.""" 8080 8081 def run( 8082 self, 8083 execution: Execution, 8084 ) -> list[str]: 8085 """ 8086 Build command line arguments. This method is called by the main command. 8087 8088 Args: 8089 execution: The execution object. 8090 Returns: 8091 Command line arguments 8092 """ 8093 cargs = [] 8094 cargs.extend([ 8095 "-noverbose", 8096 self.noverbose 8097 ]) 8098 return cargs 8099 8100 8101@dataclasses.dataclass 8102class C3dVersion: 8103 """ 8104 No description found. 8105 """ 8106 version: str 8107 """No description found.""" 8108 8109 def run( 8110 self, 8111 execution: Execution, 8112 ) -> list[str]: 8113 """ 8114 Build command line arguments. This method is called by the main command. 8115 8116 Args: 8117 execution: The execution object. 8118 Returns: 8119 Command line arguments 8120 """ 8121 cargs = [] 8122 cargs.extend([ 8123 "-version", 8124 self.version 8125 ]) 8126 return cargs 8127 8128 8129@dataclasses.dataclass 8130class C3dVote: 8131 """ 8132 -vote: Vote among images on the stack 8133 8134 Syntax: `-vote ` 8135 8136 This command takes all images on the stack as arguments and at each voxel 8137 *(i,j,k)* returns the index of the image for which the image value at 8138 *(i,j,k)* is the greatest. This is most useful when combining probability 8139 maps into a single label image. If images prob1.img, prob2.img, etc. give 8140 the probability of label 1, 2, etc. over the image domain, the **-vote** 8141 command will return the most probable label at each voxel. 8142 8143 c3d prob1.img prob2.img prob3.img -vote -type uchar -o label.img 8144 8145 The value assigned to each image is based on its position from the bottom of 8146 the stack, with zero indicating bottom-most image. In the example above, the 8147 output image has values 0 for voxels where prob1.img is highest, 1 for 8148 prob2.img and 2 for prob3.img. Also see the related commands **-split** and 8149 **-merge**. 8150 """ 8151 vote: str 8152 """-vote: Vote among images on the stack 8153 8154 Syntax: `-vote ` 8155 8156 This command takes all images on the stack as arguments and at each voxel 8157 *(i,j,k)* returns the index of the image for which the image value at 8158 *(i,j,k)* is the greatest. This is most useful when combining probability 8159 maps into a single label image. If images prob1.img, prob2.img, etc. give 8160 the probability of label 1, 2, etc. over the image domain, the **-vote** 8161 command will return the most probable label at each voxel. 8162 8163 c3d prob1.img prob2.img prob3.img -vote -type uchar -o label.img 8164 8165 The value assigned to each image is based on its position from the bottom of 8166 the stack, with zero indicating bottom-most image. In the example above, the 8167 output image has values 0 for voxels where prob1.img is highest, 1 for 8168 prob2.img and 2 for prob3.img. Also see the related commands **-split** and 8169 **-merge**.""" 8170 8171 def run( 8172 self, 8173 execution: Execution, 8174 ) -> list[str]: 8175 """ 8176 Build command line arguments. This method is called by the main command. 8177 8178 Args: 8179 execution: The execution object. 8180 Returns: 8181 Command line arguments 8182 """ 8183 cargs = [] 8184 cargs.extend([ 8185 "-vote", 8186 self.vote 8187 ]) 8188 return cargs 8189 8190 8191@dataclasses.dataclass 8192class C3dVoteMrf: 8193 """ 8194 -vote-mrf: Vote with Markov Random Field regularlization 8195 8196 Syntax: `-vote-mrf <mode> <lambda>` 8197 8198 This command is similar to **-vote** but it performs regularlization using 8199 the Markov Random Field (MRF). This form of regularization penalizes the 8200 total surface area of the segments in the output. It results in more 8201 contiguous segments. 8202 8203 The command takes all the images on the stack and assumes that they are 8204 likelihood images corresponding to labels 1, 2, ... N. This means that voxel 8205 **x** in image **k** holds the probability that voxel **x** has label **k**. 8206 Likelihood images must be between 0 and 1. Any values outside of the range 8207 are interpreted as the voxel being excluded from the voting. These voxels 8208 will be assigned label 0 in the output. 8209 8210 The problem is encoded in the form of energy minimization, consisting of a 8211 data term and a regularization term. The data term encodes the cost 8212 (penalty) associated with assigning the voxel **x** the label **k**. The 8213 parameter **mode** describes how likelihood images are mapped to the cost. 8214 8215 * `VOTES_AGAINST` or `VA`. This mode is useful when the command is being 8216 used to combine several multi-label segmentations into a single one. Each 8217 likelihood image is assumed to be the proportion of segmentations that 8218 assign label *k* to voxel *x*. The data term equals to the error associated 8219 to assining the voxel *k* label *x*. This error is calculated as the sum of 8220 the likelihoods for all labels at *x* minus the likelihood for *k* at *x*. 8221 Note that the likelihoods do not have to add up to one, which may be 8222 interpreted as missing data for some voxels. 8223 8224 * `LOG_LIKELIHOOD` or `LL`. The cost for label *k* at voxel *x* is the 8225 logarithm of the k-th likelihood image at *x*. This will assign infinite 8226 cost when the likelihood is zero. 8227 8228 The regularlization term is encoded as **lambda** times the total number of 8229 neighboring voxels inside the mask (non-excluded region of the image) that 8230 have different labels. 8231 8232 The optmization problem is solved using the Alpha-Expansion graph cut 8233 algorithm. Users of this functionality should cite the following papers. 8234 8235 1. Yuri Boykov, Olga Veksler, Ramin Zabih, *Efficient Approximate Energy 8236 Minimization via Graph Cuts*, IEEE transactions on PAMI, vol. 20, no. 12, p. 8237 1222-1239, 2001. 8238 8239 2. Vladimir Kolmogorov and Ramin Zabih, *What Energy Functions can be 8240 Minimized via Graph Cuts?*, IEEE transactions on PAMI, vol. 26, no. 2, p. 8241 147-159, 2004. 8242 8243 3. Yuri Boykov and Vladimir Kolmogorov, *An Experimental Comparison of 8244 Min-Cut/Max-Flow Algorithms for Energy Minimization in Vision*, IEEE 8245 transactions on PAMI, vol. 26, no. 9, p. 1124-1137, 2004. 8246 8247 As noted in the open source implementation of the graph cuts algorithms 8248 distributed under the General Public License, "This software can be used 8249 only for research purposes, you should cite the aforementioned paper in any 8250 resulting publication. If you wish to use this software (or the algorithms 8251 described in the aforementioned paper) for commercial purposes, you should 8252 be aware that there is a US patent: R. Zabih, Y. Boykov, O. Veksler, *System 8253 and method for fast approximate energy minimization via graph cuts*, United 8254 Stated Patent 6,744,923, June 1, 2004. 8255 8256 The example below illustrates applying **-vote-mrf** with a user-specified 8257 mask. Voxels outside of the mask are first remapped to NaN (not a number) 8258 and thus excluded from the MRF optimization and given 0 label. 8259 8260 c3d lhood01.nii lhood02.nii lhood03.nii mask.nii -popas M \ 8261 -foreach -push M -replace 0 NaN -times -endfor \ 8262 -vote-mrf VA 0.2 -o result.nii. 8263 """ 8264 vote_mrf: str 8265 """-vote-mrf: Vote with Markov Random Field regularlization 8266 8267 Syntax: `-vote-mrf <mode> <lambda>` 8268 8269 This command is similar to **-vote** but it performs regularlization using 8270 the Markov Random Field (MRF). This form of regularization penalizes the 8271 total surface area of the segments in the output. It results in more 8272 contiguous segments. 8273 8274 The command takes all the images on the stack and assumes that they are 8275 likelihood images corresponding to labels 1, 2, ... N. This means that voxel 8276 **x** in image **k** holds the probability that voxel **x** has label **k**. 8277 Likelihood images must be between 0 and 1. Any values outside of the range 8278 are interpreted as the voxel being excluded from the voting. These voxels 8279 will be assigned label 0 in the output. 8280 8281 The problem is encoded in the form of energy minimization, consisting of a 8282 data term and a regularization term. The data term encodes the cost 8283 (penalty) associated with assigning the voxel **x** the label **k**. The 8284 parameter **mode** describes how likelihood images are mapped to the cost. 8285 8286 * `VOTES_AGAINST` or `VA`. This mode is useful when the command is being 8287 used to combine several multi-label segmentations into a single one. Each 8288 likelihood image is assumed to be the proportion of segmentations that 8289 assign label *k* to voxel *x*. The data term equals to the error associated 8290 to assining the voxel *k* label *x*. This error is calculated as the sum of 8291 the likelihoods for all labels at *x* minus the likelihood for *k* at *x*. 8292 Note that the likelihoods do not have to add up to one, which may be 8293 interpreted as missing data for some voxels. 8294 8295 * `LOG_LIKELIHOOD` or `LL`. The cost for label *k* at voxel *x* is the 8296 logarithm of the k-th likelihood image at *x*. This will assign infinite 8297 cost when the likelihood is zero. 8298 8299 The regularlization term is encoded as **lambda** times the total number of 8300 neighboring voxels inside the mask (non-excluded region of the image) that 8301 have different labels. 8302 8303 The optmization problem is solved using the Alpha-Expansion graph cut 8304 algorithm. Users of this functionality should cite the following papers. 8305 8306 1. Yuri Boykov, Olga Veksler, Ramin Zabih, *Efficient Approximate Energy 8307 Minimization via Graph Cuts*, IEEE transactions on PAMI, vol. 20, no. 12, p. 8308 1222-1239, 2001. 8309 8310 2. Vladimir Kolmogorov and Ramin Zabih, *What Energy Functions can be 8311 Minimized via Graph Cuts?*, IEEE transactions on PAMI, vol. 26, no. 2, p. 8312 147-159, 2004. 8313 8314 3. Yuri Boykov and Vladimir Kolmogorov, *An Experimental Comparison of 8315 Min-Cut/Max-Flow Algorithms for Energy Minimization in Vision*, IEEE 8316 transactions on PAMI, vol. 26, no. 9, p. 1124-1137, 2004. 8317 8318 As noted in the open source implementation of the graph cuts algorithms 8319 distributed under the General Public License, "This software can be used 8320 only for research purposes, you should cite the aforementioned paper in any 8321 resulting publication. If you wish to use this software (or the algorithms 8322 described in the aforementioned paper) for commercial purposes, you should 8323 be aware that there is a US patent: R. Zabih, Y. Boykov, O. Veksler, *System 8324 and method for fast approximate energy minimization via graph cuts*, United 8325 Stated Patent 6,744,923, June 1, 2004. 8326 8327 The example below illustrates applying **-vote-mrf** with a user-specified 8328 mask. Voxels outside of the mask are first remapped to NaN (not a number) 8329 and thus excluded from the MRF optimization and given 0 label. 8330 8331 c3d lhood01.nii lhood02.nii lhood03.nii mask.nii -popas M \ 8332 -foreach -push M -replace 0 NaN -times -endfor \ 8333 -vote-mrf VA 0.2 -o result.nii""" 8334 8335 def run( 8336 self, 8337 execution: Execution, 8338 ) -> list[str]: 8339 """ 8340 Build command line arguments. This method is called by the main command. 8341 8342 Args: 8343 execution: The execution object. 8344 Returns: 8345 Command line arguments 8346 """ 8347 cargs = [] 8348 cargs.extend([ 8349 "-vote-mrf", 8350 self.vote_mrf 8351 ]) 8352 return cargs 8353 8354 8355@dataclasses.dataclass 8356class C3dVoteLabel: 8357 """ 8358 No description found. 8359 """ 8360 vote_label: str 8361 """No description found.""" 8362 8363 def run( 8364 self, 8365 execution: Execution, 8366 ) -> list[str]: 8367 """ 8368 Build command line arguments. This method is called by the main command. 8369 8370 Args: 8371 execution: The execution object. 8372 Returns: 8373 Command line arguments 8374 """ 8375 cargs = [] 8376 cargs.extend([ 8377 "-vote-label", 8378 self.vote_label 8379 ]) 8380 return cargs 8381 8382 8383@dataclasses.dataclass 8384class C3dVoxelSum: 8385 """ 8386 -voxel-sum: Print sum of all voxel intensities 8387 8388 Syntax: `-voxel-sum ` 8389 8390 Print the sum of all voxels in the image. 8391 8392 $ c3d image.img -voxel-sum 8393 Voxel Sum: 200923123. 8394 """ 8395 voxel_sum: str 8396 """-voxel-sum: Print sum of all voxel intensities 8397 8398 Syntax: `-voxel-sum ` 8399 8400 Print the sum of all voxels in the image. 8401 8402 $ c3d image.img -voxel-sum 8403 Voxel Sum: 200923123""" 8404 8405 def run( 8406 self, 8407 execution: Execution, 8408 ) -> list[str]: 8409 """ 8410 Build command line arguments. This method is called by the main command. 8411 8412 Args: 8413 execution: The execution object. 8414 Returns: 8415 Command line arguments 8416 """ 8417 cargs = [] 8418 cargs.extend([ 8419 "-voxel-sum", 8420 self.voxel_sum 8421 ]) 8422 return cargs 8423 8424 8425@dataclasses.dataclass 8426class C3dVoxelIntegral: 8427 """ 8428 -voxel-integral: Print volume integral of all voxel intensities 8429 8430 Syntax: `-voxel-integral` 8431 8432 Like **-voxel-sum**, but multiplies the sum of voxel intensities by voxel 8433 volume. This is useful for computing volumes of objects represented by 8434 binary images. The result is in 'ml'. 8435 8436 $ c3d image.img -voxel-integral 8437 Voxel Integral: 2341. 8438 """ 8439 voxel_integral: str 8440 """-voxel-integral: Print volume integral of all voxel intensities 8441 8442 Syntax: `-voxel-integral` 8443 8444 Like **-voxel-sum**, but multiplies the sum of voxel intensities by voxel 8445 volume. This is useful for computing volumes of objects represented by 8446 binary images. The result is in 'ml'. 8447 8448 $ c3d image.img -voxel-integral 8449 Voxel Integral: 2341""" 8450 8451 def run( 8452 self, 8453 execution: Execution, 8454 ) -> list[str]: 8455 """ 8456 Build command line arguments. This method is called by the main command. 8457 8458 Args: 8459 execution: The execution object. 8460 Returns: 8461 Command line arguments 8462 """ 8463 cargs = [] 8464 cargs.extend([ 8465 "-voxel-integral", 8466 self.voxel_integral 8467 ]) 8468 return cargs 8469 8470 8471@dataclasses.dataclass 8472class C3dVoxelwiseRegression: 8473 """ 8474 -voxreg, -voxelwise-regression: Regression between two images 8475 8476 Syntax: `-voxreg regression_order ` 8477 8478 Perform regression between corresponding voxels in two images. This command 8479 takes two images as input, X and Y. This command finds parameters b\_0, 8480 b\_1, ..., b\_k, such that Y is best approximated by b\_0 + b\_1 * X + b\_2 8481 * X^2 + ... + b_k * X^k. Here is an example of linear regression. 8482 8483 $ c3d Y.nii X.nii -voxreg 2 8484 REGCOEFF[0] = 5.56935 8485 REGCOEFF[1] = 0.844024 8486 8487 $ c3d Y.nii X.nii -scale 0.844024 -shift 5.56935 -voxreg 2 8488 REGCOEFF[0] = 0 8489 REGCOEFF[1] = 1. 8490 """ 8491 voxelwise_regression: str 8492 """-voxreg, -voxelwise-regression: Regression between two images 8493 8494 Syntax: `-voxreg regression_order ` 8495 8496 Perform regression between corresponding voxels in two images. This command 8497 takes two images as input, X and Y. This command finds parameters b\_0, 8498 b\_1, ..., b\_k, such that Y is best approximated by b\_0 + b\_1 * X + b\_2 8499 * X^2 + ... + b_k * X^k. Here is an example of linear regression. 8500 8501 $ c3d Y.nii X.nii -voxreg 2 8502 REGCOEFF[0] = 5.56935 8503 REGCOEFF[1] = 0.844024 8504 8505 $ c3d Y.nii X.nii -scale 0.844024 -shift 5.56935 -voxreg 2 8506 REGCOEFF[0] = 0 8507 REGCOEFF[1] = 1""" 8508 8509 def run( 8510 self, 8511 execution: Execution, 8512 ) -> list[str]: 8513 """ 8514 Build command line arguments. This method is called by the main command. 8515 8516 Args: 8517 execution: The execution object. 8518 Returns: 8519 Command line arguments 8520 """ 8521 cargs = [] 8522 cargs.extend([ 8523 "-voxelwise-regression", 8524 self.voxelwise_regression 8525 ]) 8526 return cargs 8527 8528 8529@dataclasses.dataclass 8530class C3dWarp: 8531 """ 8532 No description found. 8533 """ 8534 warp: str 8535 """No description found.""" 8536 8537 def run( 8538 self, 8539 execution: Execution, 8540 ) -> list[str]: 8541 """ 8542 Build command line arguments. This method is called by the main command. 8543 8544 Args: 8545 execution: The execution object. 8546 Returns: 8547 Command line arguments 8548 """ 8549 cargs = [] 8550 cargs.extend([ 8551 "-warp", 8552 self.warp 8553 ]) 8554 return cargs 8555 8556 8557@dataclasses.dataclass 8558class C3dWarpLabel: 8559 """ 8560 No description found. 8561 """ 8562 warp_label: str 8563 """No description found.""" 8564 8565 def run( 8566 self, 8567 execution: Execution, 8568 ) -> list[str]: 8569 """ 8570 Build command line arguments. This method is called by the main command. 8571 8572 Args: 8573 execution: The execution object. 8574 Returns: 8575 Command line arguments 8576 """ 8577 cargs = [] 8578 cargs.extend([ 8579 "-warp-label", 8580 self.warp_label 8581 ]) 8582 return cargs 8583 8584 8585@dataclasses.dataclass 8586class C3dWrap: 8587 """ 8588 -wrap: Wrap (rotate) image 8589 8590 Syntax: `-wrap <vector> ` 8591 8592 Wrap image around one or more voxel dimensions. Wrapping is typically used 8593 to correct for MRI wrap-around artifacts. The vector must have integer 8594 components, possibly negative. For example, 8595 8596 c3d badmri.nii.gz -wrap 0x20x0 -o fixedmri.nii.gz 8597 8598 will wrap the image in the second voxel dimension by 20 voxels (i.e., voxel 8599 at 10x40x20 will me moved to the position 10x20x20). 8600 8601 8602 ### Commands: Options and Parameters 8603 8604 Options change the behavior of commands that *appear later on the command 8605 line*. This is very important. Specifying options after the command will 8606 have no effect. 8607 """ 8608 wrap: str 8609 """-wrap: Wrap (rotate) image 8610 8611 Syntax: `-wrap <vector> ` 8612 8613 Wrap image around one or more voxel dimensions. Wrapping is typically used 8614 to correct for MRI wrap-around artifacts. The vector must have integer 8615 components, possibly negative. For example, 8616 8617 c3d badmri.nii.gz -wrap 0x20x0 -o fixedmri.nii.gz 8618 8619 will wrap the image in the second voxel dimension by 20 voxels (i.e., voxel 8620 at 10x40x20 will me moved to the position 10x20x20). 8621 8622 8623 ### Commands: Options and Parameters 8624 8625 Options change the behavior of commands that *appear later on the command 8626 line*. This is very important. Specifying options after the command will 8627 have no effect.""" 8628 8629 def run( 8630 self, 8631 execution: Execution, 8632 ) -> list[str]: 8633 """ 8634 Build command line arguments. This method is called by the main command. 8635 8636 Args: 8637 execution: The execution object. 8638 Returns: 8639 Command line arguments 8640 """ 8641 cargs = [] 8642 cargs.extend([ 8643 "-wrap", 8644 self.wrap 8645 ]) 8646 return cargs 8647 8648 8649@dataclasses.dataclass 8650class C3dWeightedSum: 8651 """ 8652 -wsum, -weighted-sum: Weighed sum of images with constant weights 8653 8654 Syntax: `-wsum weight1 weight2 ... weightN ` 8655 8656 Computes weighted sum of the last N images on the stack. 8657 8658 c3d image1.nii image2.nii image3.nii -wsum 0.2 0.7 0.1 -o wsum.nii 8659 8660 This command is particularly useful for combining components in a 8661 multicomponent image. For example, for an RGB image, we can convert it to 8662 grayscale (using [ImageMagick][13] formula) as follows: 8663 8664 c3d -mcs rgb.nii -wsum 0.29900 0.58700 0.11400 -o gray.nii. 8665 """ 8666 weighted_sum: str 8667 """-wsum, -weighted-sum: Weighed sum of images with constant weights 8668 8669 Syntax: `-wsum weight1 weight2 ... weightN ` 8670 8671 Computes weighted sum of the last N images on the stack. 8672 8673 c3d image1.nii image2.nii image3.nii -wsum 0.2 0.7 0.1 -o wsum.nii 8674 8675 This command is particularly useful for combining components in a 8676 multicomponent image. For example, for an RGB image, we can convert it to 8677 grayscale (using [ImageMagick][13] formula) as follows: 8678 8679 c3d -mcs rgb.nii -wsum 0.29900 0.58700 0.11400 -o gray.nii""" 8680 8681 def run( 8682 self, 8683 execution: Execution, 8684 ) -> list[str]: 8685 """ 8686 Build command line arguments. This method is called by the main command. 8687 8688 Args: 8689 execution: The execution object. 8690 Returns: 8691 Command line arguments 8692 """ 8693 cargs = [] 8694 cargs.extend([ 8695 "-weighted-sum", 8696 self.weighted_sum 8697 ]) 8698 return cargs 8699 8700 8701@dataclasses.dataclass 8702class C3dWeightedSumVoxelwise: 8703 """ 8704 -wsv, -weighed-sum-voxelwise: Weighed sum of images with spatially varying 8705 weights 8706 8707 Syntax: `-wsv ` 8708 8709 Computes weighted sum of N weight images and N scalar images. The images 8710 must be interleaved on the stack. All images on the stack are used. 8711 8712 c3d weight1.nii image1.nii weight2.nii image2.nii weight3.nii image3.nii 8713 -wsv -o mysum.nii.gz 8714 8715 The **-reorder** command can simplify loading the images: 8716 8717 c3d weight*.nii image*.nii -reorder 0.5 -wsv -o mysum.nii.gz 8718 8719 ### Commands: Image Header Manipulation. 8720 """ 8721 weighted_sum_voxelwise: str 8722 """-wsv, -weighed-sum-voxelwise: Weighed sum of images with spatially 8723 varying weights 8724 8725 Syntax: `-wsv ` 8726 8727 Computes weighted sum of N weight images and N scalar images. The images 8728 must be interleaved on the stack. All images on the stack are used. 8729 8730 c3d weight1.nii image1.nii weight2.nii image2.nii weight3.nii image3.nii 8731 -wsv -o mysum.nii.gz 8732 8733 The **-reorder** command can simplify loading the images: 8734 8735 c3d weight*.nii image*.nii -reorder 0.5 -wsv -o mysum.nii.gz 8736 8737 ### Commands: Image Header Manipulation""" 8738 8739 def run( 8740 self, 8741 execution: Execution, 8742 ) -> list[str]: 8743 """ 8744 Build command line arguments. This method is called by the main command. 8745 8746 Args: 8747 execution: The execution object. 8748 Returns: 8749 Command line arguments 8750 """ 8751 cargs = [] 8752 cargs.extend([ 8753 "-weighted-sum-voxelwise", 8754 self.weighted_sum_voxelwise 8755 ]) 8756 return cargs 8757 8758 8759class C3dOutputs(typing.NamedTuple): 8760 """ 8761 Output object returned when calling `c3d_(...)`. 8762 """ 8763 root: OutputPathType 8764 """Output root folder. This is the root folder for all outputs.""" 8765 8766 8767def c3d_( 8768 input_: list[InputPathType], 8769 operations: typing.Union[C3dAccum, C3dAcos, C3dAdd, C3dAlignLandmarks, C3dAnisotropicDiffusion, C3dAntialias, C3dSet, C3dAsin, C3dAtan2, C3dBackground, C3dN4BiasCorrection, C3dBinarize, C3dCanny, C3dCeil, C3dCentroid, C3dCentroidMark, C3dConnectedComponents, C3dClear, C3dClip, C3dColorMap, C3dCompress, C3dNoCompress, C3dConv, C3dCoordinateMapVoxel, C3dCoordinateMapPhysical, C3dCopyTransform, C3dCos, C3dCreate, C3dDicomSeriesList, C3dDicomSeriesRead, C3dDilate, C3dDivide, C3dDuplicate, C3dEndaccum, C3dEndfor, C3dErode, C3dErf, C3dExp, C3dExportPatches, C3dExportPatchesAug, C3dExtrudeSeg, C3dFillBackgroundWithNoise, C3dFft, C3dFlip, C3dFloor, C3dForeach, C3dForeachComp, C3dGlm, C3dGradient, C3dHelp, C3dHolefill, C3dHessianEigenvalues, C3dHessianObjectness, C3dHistogramMatch, C3dInfo, C3dInfoFull, C3dInsert, C3dInterpolation, C3dIterations, C3dLabelOverlap, C3dLabelStatistics, C3dLandmarksToSpheres, C3dLaplacian, C3dLevelset, C3dLevelsetCurvature, C3dLevelsetAdvection, C3dLog, C3dLog10, C3dManual, C3dMatchBoundingBox, C3dMaximum, C3dMulticomponentSplit, C3dMean, C3dMedianFilter, C3dMerge, C3dMeanFilter, C3dMutualInfo, C3dMinimum, C3dMixtureModel, C3dMoments, C3dMattesMutualInfo, C3dMeanSquare, C3dMultiply, C3dNormalizedCrossCorrelation, C3dNormalizedCorrelation, C3dNormalizedMutualInfo, C3dNoiseGaussian, C3dNoisePoisson, C3dNoiseSpeckle, C3dNoiseSaltPepper, C3dNoMulticomponentSplit, C3dNormalizeLocalWindow, C3dNormpdf, C3dNoround, C3dNospm, C3dOutput, C3dOutputMulticomponent, C3dOutputMultipleMulticomponent, C3dOrient, C3dOutputMultiple, C3dOrient_, C3dOrigin, C3dOriginVoxel, C3dOriginVoxelCoord, C3dOverlap, C3dOverlayLabelImage, C3dPad, C3dPadTo, C3dPca, C3dPercentIntensityMode, C3dPixel, C3dPop, C3dPopas, C3dProbe, C3dPush, C3dRank, C3dReciprocal, C3dRegion, C3dReorder, C3dRetainLabels, C3dRfApply, C3dRfTrain, C3dRfParamPatch, C3dRfParamUsexyz, C3dRfParamNousexyz, C3dRfParamNtrees, C3dRfParamTreedepth, C3dSetSform, C3dReplace, C3dResample, C3dResampleIso, C3dResampleMm, C3dResliceItk, C3dResliceMatrix, C3dResliceIdentity, C3dRgb2hsv, C3dRms, C3dRound, C3dScale, C3dSetSform_, C3dSin, C3dSlice, C3dSliceAll, C3dSharpen, C3dShift, C3dSignedDistanceTransform, C3dSmooth, C3dSmoothFast, C3dSpacing, C3dSplit, C3dSqrt, C3dStaple, C3dStructureTensorEigenvalues, C3dSpm, C3dSubtract, C3dSupervoxel, C3dStretch, C3dSwapdim, C3dTestImage, C3dTestProbe, C3dThreshold, C3dTile, C3dTrim, C3dTrimToSize, C3dType, C3dVerbose, C3dNoverbose, C3dVersion, C3dVote, C3dVoteMrf, C3dVoteLabel, C3dVoxelSum, C3dVoxelIntegral, C3dVoxelwiseRegression, C3dWarp, C3dWarpLabel, C3dWrap, C3dWeightedSum, C3dWeightedSumVoxelwise], 8770 output: str, 8771 runner: Runner | None = None, 8772) -> C3dOutputs: 8773 """ 8774 C3D is a command-line tool for medical image processing. 8775 8776 Author: ITK-Snap Team 8777 8778 Args: 8779 input_: The input image to process. 8780 operations: The operations to perform. 8781 output: The output image. 8782 runner: Command runner. 8783 Returns: 8784 NamedTuple of outputs (described in `C3dOutputs`). 8785 """ 8786 runner = runner or get_global_runner() 8787 execution = runner.start_execution(C3D_METADATA) 8788 cargs = [] 8789 cargs.append("c3d") 8790 cargs.append(" ".join([execution.input_file(f) for f in input_])) 8791 cargs.extend(operations.run(execution)) 8792 cargs.extend([ 8793 "-o", 8794 output 8795 ]) 8796 ret = C3dOutputs( 8797 root=execution.output_file("."), 8798 ) 8799 execution.run(cargs) 8800 return ret 8801 8802 8803__all__ = [ 8804 "C3D_METADATA", 8805 "C3dAccum", 8806 "C3dAcos", 8807 "C3dAdd", 8808 "C3dAlignLandmarks", 8809 "C3dAnisotropicDiffusion", 8810 "C3dAntialias", 8811 "C3dAsin", 8812 "C3dAtan2", 8813 "C3dBackground", 8814 "C3dBinarize", 8815 "C3dCanny", 8816 "C3dCeil", 8817 "C3dCentroid", 8818 "C3dCentroidMark", 8819 "C3dClear", 8820 "C3dClip", 8821 "C3dColorMap", 8822 "C3dCompress", 8823 "C3dConnectedComponents", 8824 "C3dConv", 8825 "C3dCoordinateMapPhysical", 8826 "C3dCoordinateMapVoxel", 8827 "C3dCopyTransform", 8828 "C3dCos", 8829 "C3dCreate", 8830 "C3dDicomSeriesList", 8831 "C3dDicomSeriesRead", 8832 "C3dDilate", 8833 "C3dDivide", 8834 "C3dDuplicate", 8835 "C3dEndaccum", 8836 "C3dEndfor", 8837 "C3dErf", 8838 "C3dErode", 8839 "C3dExp", 8840 "C3dExportPatches", 8841 "C3dExportPatchesAug", 8842 "C3dExtrudeSeg", 8843 "C3dFft", 8844 "C3dFillBackgroundWithNoise", 8845 "C3dFlip", 8846 "C3dFloor", 8847 "C3dForeach", 8848 "C3dForeachComp", 8849 "C3dGlm", 8850 "C3dGradient", 8851 "C3dHelp", 8852 "C3dHessianEigenvalues", 8853 "C3dHessianObjectness", 8854 "C3dHistogramMatch", 8855 "C3dHolefill", 8856 "C3dInfo", 8857 "C3dInfoFull", 8858 "C3dInsert", 8859 "C3dInterpolation", 8860 "C3dIterations", 8861 "C3dLabelOverlap", 8862 "C3dLabelStatistics", 8863 "C3dLandmarksToSpheres", 8864 "C3dLaplacian", 8865 "C3dLevelset", 8866 "C3dLevelsetAdvection", 8867 "C3dLevelsetCurvature", 8868 "C3dLog", 8869 "C3dLog10", 8870 "C3dManual", 8871 "C3dMatchBoundingBox", 8872 "C3dMattesMutualInfo", 8873 "C3dMaximum", 8874 "C3dMean", 8875 "C3dMeanFilter", 8876 "C3dMeanSquare", 8877 "C3dMedianFilter", 8878 "C3dMerge", 8879 "C3dMinimum", 8880 "C3dMixtureModel", 8881 "C3dMoments", 8882 "C3dMulticomponentSplit", 8883 "C3dMultiply", 8884 "C3dMutualInfo", 8885 "C3dN4BiasCorrection", 8886 "C3dNoCompress", 8887 "C3dNoMulticomponentSplit", 8888 "C3dNoiseGaussian", 8889 "C3dNoisePoisson", 8890 "C3dNoiseSaltPepper", 8891 "C3dNoiseSpeckle", 8892 "C3dNormalizeLocalWindow", 8893 "C3dNormalizedCorrelation", 8894 "C3dNormalizedCrossCorrelation", 8895 "C3dNormalizedMutualInfo", 8896 "C3dNormpdf", 8897 "C3dNoround", 8898 "C3dNospm", 8899 "C3dNoverbose", 8900 "C3dOrient", 8901 "C3dOrient_", 8902 "C3dOrigin", 8903 "C3dOriginVoxel", 8904 "C3dOriginVoxelCoord", 8905 "C3dOutput", 8906 "C3dOutputMulticomponent", 8907 "C3dOutputMultiple", 8908 "C3dOutputMultipleMulticomponent", 8909 "C3dOutputs", 8910 "C3dOverlap", 8911 "C3dOverlayLabelImage", 8912 "C3dPad", 8913 "C3dPadTo", 8914 "C3dPca", 8915 "C3dPercentIntensityMode", 8916 "C3dPixel", 8917 "C3dPop", 8918 "C3dPopas", 8919 "C3dProbe", 8920 "C3dPush", 8921 "C3dRank", 8922 "C3dReciprocal", 8923 "C3dRegion", 8924 "C3dReorder", 8925 "C3dReplace", 8926 "C3dResample", 8927 "C3dResampleIso", 8928 "C3dResampleMm", 8929 "C3dResliceIdentity", 8930 "C3dResliceItk", 8931 "C3dResliceMatrix", 8932 "C3dRetainLabels", 8933 "C3dRfApply", 8934 "C3dRfParamNousexyz", 8935 "C3dRfParamNtrees", 8936 "C3dRfParamPatch", 8937 "C3dRfParamTreedepth", 8938 "C3dRfParamUsexyz", 8939 "C3dRfTrain", 8940 "C3dRgb2hsv", 8941 "C3dRms", 8942 "C3dRound", 8943 "C3dScale", 8944 "C3dSet", 8945 "C3dSetSform", 8946 "C3dSetSform_", 8947 "C3dSharpen", 8948 "C3dShift", 8949 "C3dSignedDistanceTransform", 8950 "C3dSin", 8951 "C3dSlice", 8952 "C3dSliceAll", 8953 "C3dSmooth", 8954 "C3dSmoothFast", 8955 "C3dSpacing", 8956 "C3dSplit", 8957 "C3dSpm", 8958 "C3dSqrt", 8959 "C3dStaple", 8960 "C3dStretch", 8961 "C3dStructureTensorEigenvalues", 8962 "C3dSubtract", 8963 "C3dSupervoxel", 8964 "C3dSwapdim", 8965 "C3dTestImage", 8966 "C3dTestProbe", 8967 "C3dThreshold", 8968 "C3dTile", 8969 "C3dTrim", 8970 "C3dTrimToSize", 8971 "C3dType", 8972 "C3dVerbose", 8973 "C3dVersion", 8974 "C3dVote", 8975 "C3dVoteLabel", 8976 "C3dVoteMrf", 8977 "C3dVoxelIntegral", 8978 "C3dVoxelSum", 8979 "C3dVoxelwiseRegression", 8980 "C3dWarp", 8981 "C3dWarpLabel", 8982 "C3dWeightedSum", 8983 "C3dWeightedSumVoxelwise", 8984 "C3dWrap", 8985 "c3d_", 8986]
18@dataclasses.dataclass 19class C3dAccum: 20 """ 21 -accum, -endaccum: Accumulate operations over all images 22 23 Syntax: `-accum command-list -endaccum` 24 25 Apply a binary operation (such as addition or multiplication) to all the 26 images on the stack in a cumulative fashion. The command(s) will be applied 27 to the last and second-to-last images on the stack, then to the result of 28 this operation and the third-to-last image on the stack and so on. Below is 29 the example of using the command to add multiple images. 30 31 c3d image*.nii -accum -add -endaccum -o sum.nii. 32 """ 33 accum: str 34 """-accum, -endaccum: Accumulate operations over all images 35 36 Syntax: `-accum command-list -endaccum` 37 38 Apply a binary operation (such as addition or multiplication) to all the 39 images on the stack in a cumulative fashion. The command(s) will be applied 40 to the last and second-to-last images on the stack, then to the result of 41 this operation and the third-to-last image on the stack and so on. Below is 42 the example of using the command to add multiple images. 43 44 c3d image*.nii -accum -add -endaccum -o sum.nii""" 45 46 def run( 47 self, 48 execution: Execution, 49 ) -> list[str]: 50 """ 51 Build command line arguments. This method is called by the main command. 52 53 Args: 54 execution: The execution object. 55 Returns: 56 Command line arguments 57 """ 58 cargs = [] 59 cargs.extend([ 60 "-accum", 61 self.accum 62 ]) 63 return cargs
-accum, -endaccum: Accumulate operations over all images
Syntax: -accum command-list -endaccum
Apply a binary operation (such as addition or multiplication) to all the images on the stack in a cumulative fashion. The command(s) will be applied to the last and second-to-last images on the stack, then to the result of this operation and the third-to-last image on the stack and so on. Below is the example of using the command to add multiple images.
c3d image*.nii -accum -add -endaccum -o sum.nii.
-accum, -endaccum: Accumulate operations over all images
Syntax: -accum command-list -endaccum
Apply a binary operation (such as addition or multiplication) to all the images on the stack in a cumulative fashion. The command(s) will be applied to the last and second-to-last images on the stack, then to the result of this operation and the third-to-last image on the stack and so on. Below is the example of using the command to add multiple images.
c3d image*.nii -accum -add -endaccum -o sum.nii
46 def run( 47 self, 48 execution: Execution, 49 ) -> list[str]: 50 """ 51 Build command line arguments. This method is called by the main command. 52 53 Args: 54 execution: The execution object. 55 Returns: 56 Command line arguments 57 """ 58 cargs = [] 59 cargs.extend([ 60 "-accum", 61 self.accum 62 ]) 63 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
66@dataclasses.dataclass 67class C3dAcos: 68 """ 69 No description found. 70 """ 71 acos: str 72 """No description found.""" 73 74 def run( 75 self, 76 execution: Execution, 77 ) -> list[str]: 78 """ 79 Build command line arguments. This method is called by the main command. 80 81 Args: 82 execution: The execution object. 83 Returns: 84 Command line arguments 85 """ 86 cargs = [] 87 cargs.extend([ 88 "-acos", 89 self.acos 90 ]) 91 return cargs
No description found.
74 def run( 75 self, 76 execution: Execution, 77 ) -> list[str]: 78 """ 79 Build command line arguments. This method is called by the main command. 80 81 Args: 82 execution: The execution object. 83 Returns: 84 Command line arguments 85 """ 86 cargs = [] 87 cargs.extend([ 88 "-acos", 89 self.acos 90 ]) 91 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
94@dataclasses.dataclass 95class C3dAdd: 96 """ 97 -add: Voxelwise image addition 98 99 Syntax: `-add` 100 101 Adds the last two images on the stack, and places the sum at the end of the 102 stack. 103 104 # Add two images: x = a + b 105 c3d a.img b.img -add -o x.img 106 107 # Add three images, x = (a + b) + c in the first example, x = a + (b + c) in 108 the second 109 c3d a.img b.img -add c.img -add -o x.img 110 c3d a.img b.img c.img -add -add -o x.img 111 112 # Subtract two images, using -scale command: x = a - b 113 c3d a.img b.img -scale -1 -add -o x.img. 114 """ 115 add: str 116 """-add: Voxelwise image addition 117 118 Syntax: `-add` 119 120 Adds the last two images on the stack, and places the sum at the end of the 121 stack. 122 123 # Add two images: x = a + b 124 c3d a.img b.img -add -o x.img 125 126 # Add three images, x = (a + b) + c in the first example, x = a + (b + c) in 127 the second 128 c3d a.img b.img -add c.img -add -o x.img 129 c3d a.img b.img c.img -add -add -o x.img 130 131 # Subtract two images, using -scale command: x = a - b 132 c3d a.img b.img -scale -1 -add -o x.img""" 133 134 def run( 135 self, 136 execution: Execution, 137 ) -> list[str]: 138 """ 139 Build command line arguments. This method is called by the main command. 140 141 Args: 142 execution: The execution object. 143 Returns: 144 Command line arguments 145 """ 146 cargs = [] 147 cargs.extend([ 148 "-add", 149 self.add 150 ]) 151 return cargs
-add: Voxelwise image addition
Syntax: -add
Adds the last two images on the stack, and places the sum at the end of the stack.
Add two images: x = a + b
c3d a.img b.img -add -o x.img
Add three images, x = (a + b) + c in the first example, x = a + (b + c) in
the second c3d a.img b.img -add c.img -add -o x.img c3d a.img b.img c.img -add -add -o x.img
Subtract two images, using -scale command: x = a - b
c3d a.img b.img -scale -1 -add -o x.img.
-add: Voxelwise image addition
Syntax: -add
Adds the last two images on the stack, and places the sum at the end of the stack.
Add two images: x = a + b
c3d a.img b.img -add -o x.img
Add three images, x = (a + b) + c in the first example, x = a + (b + c) in
the second c3d a.img b.img -add c.img -add -o x.img c3d a.img b.img c.img -add -add -o x.img
Subtract two images, using -scale command: x = a - b
c3d a.img b.img -scale -1 -add -o x.img
134 def run( 135 self, 136 execution: Execution, 137 ) -> list[str]: 138 """ 139 Build command line arguments. This method is called by the main command. 140 141 Args: 142 execution: The execution object. 143 Returns: 144 Command line arguments 145 """ 146 cargs = [] 147 cargs.extend([ 148 "-add", 149 self.add 150 ]) 151 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
154@dataclasses.dataclass 155class C3dAlignLandmarks: 156 """ 157 -alm, -align-landmarks: Align images based on landmark matching 158 159 Syntax: `-alm dof outfile` 160 161 Performs rigid or affine alignment between to sets of landmark images. A 162 landmark image is an image where for every intensity value, the centroid of 163 all voxels with that intensity represents a landmark. Landmarks can be 164 created using the paintbrush tool in ITK-SNAP (they can be spheres, cubes, 165 etc). The first image on the stack is the target/fixed/reference image, and 166 the second is the moving image. The parameters are the degrees of freedom, 167 which is a number (6 for rigid, 7 for rigid+scale, 12 for affine) and the 168 output matrix file. In this example, we have images **fixed.nii* and 169 **moving.nii** with corresponding landmark images. We use landmarks to align 170 the moving image to the fixed: 171 172 c3d fixed_landmarks.nii moving_landmarks.nii -alm 6 rigid.mat 173 c3d fixed.nii moving.nii -reslice-matrix rigid.mat -o 174 moving_resliced_to_fixed.nii. 175 """ 176 align_landmarks: str 177 """-alm, -align-landmarks: Align images based on landmark matching 178 179 Syntax: `-alm dof outfile` 180 181 Performs rigid or affine alignment between to sets of landmark images. A 182 landmark image is an image where for every intensity value, the centroid of 183 all voxels with that intensity represents a landmark. Landmarks can be 184 created using the paintbrush tool in ITK-SNAP (they can be spheres, cubes, 185 etc). The first image on the stack is the target/fixed/reference image, and 186 the second is the moving image. The parameters are the degrees of freedom, 187 which is a number (6 for rigid, 7 for rigid+scale, 12 for affine) and the 188 output matrix file. In this example, we have images **fixed.nii* and 189 **moving.nii** with corresponding landmark images. We use landmarks to align 190 the moving image to the fixed: 191 192 c3d fixed_landmarks.nii moving_landmarks.nii -alm 6 rigid.mat 193 c3d fixed.nii moving.nii -reslice-matrix rigid.mat -o 194 moving_resliced_to_fixed.nii""" 195 196 def run( 197 self, 198 execution: Execution, 199 ) -> list[str]: 200 """ 201 Build command line arguments. This method is called by the main command. 202 203 Args: 204 execution: The execution object. 205 Returns: 206 Command line arguments 207 """ 208 cargs = [] 209 cargs.extend([ 210 "-align-landmarks", 211 self.align_landmarks 212 ]) 213 return cargs
-alm, -align-landmarks: Align images based on landmark matching
Syntax: -alm dof outfile
Performs rigid or affine alignment between to sets of landmark images. A landmark image is an image where for every intensity value, the centroid of all voxels with that intensity represents a landmark. Landmarks can be created using the paintbrush tool in ITK-SNAP (they can be spheres, cubes, etc). The first image on the stack is the target/fixed/reference image, and the second is the moving image. The parameters are the degrees of freedom, which is a number (6 for rigid, 7 for rigid+scale, 12 for affine) and the output matrix file. In this example, we have images fixed.nii* and **moving.nii with corresponding landmark images. We use landmarks to align the moving image to the fixed:
c3d fixed_landmarks.nii moving_landmarks.nii -alm 6 rigid.mat c3d fixed.nii moving.nii -reslice-matrix rigid.mat -o moving_resliced_to_fixed.nii.
-alm, -align-landmarks: Align images based on landmark matching
Syntax: -alm dof outfile
Performs rigid or affine alignment between to sets of landmark images. A landmark image is an image where for every intensity value, the centroid of all voxels with that intensity represents a landmark. Landmarks can be created using the paintbrush tool in ITK-SNAP (they can be spheres, cubes, etc). The first image on the stack is the target/fixed/reference image, and the second is the moving image. The parameters are the degrees of freedom, which is a number (6 for rigid, 7 for rigid+scale, 12 for affine) and the output matrix file. In this example, we have images fixed.nii* and **moving.nii with corresponding landmark images. We use landmarks to align the moving image to the fixed:
c3d fixed_landmarks.nii moving_landmarks.nii -alm 6 rigid.mat c3d fixed.nii moving.nii -reslice-matrix rigid.mat -o moving_resliced_to_fixed.nii
196 def run( 197 self, 198 execution: Execution, 199 ) -> list[str]: 200 """ 201 Build command line arguments. This method is called by the main command. 202 203 Args: 204 execution: The execution object. 205 Returns: 206 Command line arguments 207 """ 208 cargs = [] 209 cargs.extend([ 210 "-align-landmarks", 211 self.align_landmarks 212 ]) 213 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
216@dataclasses.dataclass 217class C3dAnisotropicDiffusion: 218 """ 219 -add: Voxelwise image addition 220 221 Syntax: `-add` 222 223 Adds the last two images on the stack, and places the sum at the end of the 224 stack. 225 226 # Add two images: x = a + b 227 c3d a.img b.img -add -o x.img 228 229 # Add three images, x = (a + b) + c in the first example, x = a + (b + c) in 230 the second 231 c3d a.img b.img -add c.img -add -o x.img 232 c3d a.img b.img c.img -add -add -o x.img 233 234 # Subtract two images, using -scale command: x = a - b 235 c3d a.img b.img -scale -1 -add -o x.img. 236 """ 237 anisotropic_diffusion: str 238 """-add: Voxelwise image addition 239 240 Syntax: `-add` 241 242 Adds the last two images on the stack, and places the sum at the end of the 243 stack. 244 245 # Add two images: x = a + b 246 c3d a.img b.img -add -o x.img 247 248 # Add three images, x = (a + b) + c in the first example, x = a + (b + c) in 249 the second 250 c3d a.img b.img -add c.img -add -o x.img 251 c3d a.img b.img c.img -add -add -o x.img 252 253 # Subtract two images, using -scale command: x = a - b 254 c3d a.img b.img -scale -1 -add -o x.img""" 255 256 def run( 257 self, 258 execution: Execution, 259 ) -> list[str]: 260 """ 261 Build command line arguments. This method is called by the main command. 262 263 Args: 264 execution: The execution object. 265 Returns: 266 Command line arguments 267 """ 268 cargs = [] 269 cargs.extend([ 270 "-anisotropic-diffusion", 271 self.anisotropic_diffusion 272 ]) 273 return cargs
-add: Voxelwise image addition
Syntax: -add
Adds the last two images on the stack, and places the sum at the end of the stack.
Add two images: x = a + b
c3d a.img b.img -add -o x.img
Add three images, x = (a + b) + c in the first example, x = a + (b + c) in
the second c3d a.img b.img -add c.img -add -o x.img c3d a.img b.img c.img -add -add -o x.img
Subtract two images, using -scale command: x = a - b
c3d a.img b.img -scale -1 -add -o x.img.
-add: Voxelwise image addition
Syntax: -add
Adds the last two images on the stack, and places the sum at the end of the stack.
Add two images: x = a + b
c3d a.img b.img -add -o x.img
Add three images, x = (a + b) + c in the first example, x = a + (b + c) in
the second c3d a.img b.img -add c.img -add -o x.img c3d a.img b.img c.img -add -add -o x.img
Subtract two images, using -scale command: x = a - b
c3d a.img b.img -scale -1 -add -o x.img
256 def run( 257 self, 258 execution: Execution, 259 ) -> list[str]: 260 """ 261 Build command line arguments. This method is called by the main command. 262 263 Args: 264 execution: The execution object. 265 Returns: 266 Command line arguments 267 """ 268 cargs = [] 269 cargs.extend([ 270 "-anisotropic-diffusion", 271 self.anisotropic_diffusion 272 ]) 273 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
276@dataclasses.dataclass 277class C3dAntialias: 278 """ 279 No description found. 280 """ 281 antialias: str 282 """No description found.""" 283 284 def run( 285 self, 286 execution: Execution, 287 ) -> list[str]: 288 """ 289 Build command line arguments. This method is called by the main command. 290 291 Args: 292 execution: The execution object. 293 Returns: 294 Command line arguments 295 """ 296 cargs = [] 297 cargs.extend([ 298 "-antialias", 299 self.antialias 300 ]) 301 return cargs
No description found.
284 def run( 285 self, 286 execution: Execution, 287 ) -> list[str]: 288 """ 289 Build command line arguments. This method is called by the main command. 290 291 Args: 292 execution: The execution object. 293 Returns: 294 Command line arguments 295 """ 296 cargs = [] 297 cargs.extend([ 298 "-antialias", 299 self.antialias 300 ]) 301 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
356@dataclasses.dataclass 357class C3dAsin: 358 """ 359 No description found. 360 """ 361 asin: str 362 """No description found.""" 363 364 def run( 365 self, 366 execution: Execution, 367 ) -> list[str]: 368 """ 369 Build command line arguments. This method is called by the main command. 370 371 Args: 372 execution: The execution object. 373 Returns: 374 Command line arguments 375 """ 376 cargs = [] 377 cargs.extend([ 378 "-asin", 379 self.asin 380 ]) 381 return cargs
No description found.
364 def run( 365 self, 366 execution: Execution, 367 ) -> list[str]: 368 """ 369 Build command line arguments. This method is called by the main command. 370 371 Args: 372 execution: The execution object. 373 Returns: 374 Command line arguments 375 """ 376 cargs = [] 377 cargs.extend([ 378 "-asin", 379 self.asin 380 ]) 381 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
384@dataclasses.dataclass 385class C3dAtan2: 386 """ 387 -atan2: Voxelwise angle from sine and cosine 388 389 Syntax: `-atan2` 390 391 Computes the angle in radians from images containing sine and cosine. This 392 is a voxel-wise operation. It requires two images on the stack (sine 393 followed by cosine): 394 395 c3d sin_theta.nii.gz cos_theta.nii.gz -atan2 -o theta.nii.gz. 396 """ 397 atan2: str 398 """-atan2: Voxelwise angle from sine and cosine 399 400 Syntax: `-atan2` 401 402 Computes the angle in radians from images containing sine and cosine. This 403 is a voxel-wise operation. It requires two images on the stack (sine 404 followed by cosine): 405 406 c3d sin_theta.nii.gz cos_theta.nii.gz -atan2 -o theta.nii.gz""" 407 408 def run( 409 self, 410 execution: Execution, 411 ) -> list[str]: 412 """ 413 Build command line arguments. This method is called by the main command. 414 415 Args: 416 execution: The execution object. 417 Returns: 418 Command line arguments 419 """ 420 cargs = [] 421 cargs.extend([ 422 "-atan2", 423 self.atan2 424 ]) 425 return cargs
-atan2: Voxelwise angle from sine and cosine
Syntax: -atan2
Computes the angle in radians from images containing sine and cosine. This is a voxel-wise operation. It requires two images on the stack (sine followed by cosine):
c3d sin_theta.nii.gz cos_theta.nii.gz -atan2 -o theta.nii.gz.
-atan2: Voxelwise angle from sine and cosine
Syntax: -atan2
Computes the angle in radians from images containing sine and cosine. This is a voxel-wise operation. It requires two images on the stack (sine followed by cosine):
c3d sin_theta.nii.gz cos_theta.nii.gz -atan2 -o theta.nii.gz
408 def run( 409 self, 410 execution: Execution, 411 ) -> list[str]: 412 """ 413 Build command line arguments. This method is called by the main command. 414 415 Args: 416 execution: The execution object. 417 Returns: 418 Command line arguments 419 """ 420 cargs = [] 421 cargs.extend([ 422 "-atan2", 423 self.atan2 424 ]) 425 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
428@dataclasses.dataclass 429class C3dBackground: 430 """ 431 -background: Specify background intensity 432 433 Syntax: `-background <value> ` 434 435 Sets the background intensity for interpolation and other operations where 436 some default background value is needed. Default is 0. 437 """ 438 background: str 439 """-background: Specify background intensity 440 441 Syntax: `-background <value> ` 442 443 Sets the background intensity for interpolation and other operations where 444 some default background value is needed. Default is 0.""" 445 446 def run( 447 self, 448 execution: Execution, 449 ) -> list[str]: 450 """ 451 Build command line arguments. This method is called by the main command. 452 453 Args: 454 execution: The execution object. 455 Returns: 456 Command line arguments 457 """ 458 cargs = [] 459 cargs.extend([ 460 "-background", 461 self.background 462 ]) 463 return cargs
-background: Specify background intensity
Syntax: -background <value>
Sets the background intensity for interpolation and other operations where some default background value is needed. Default is 0.
-background: Specify background intensity
Syntax: -background <value>
Sets the background intensity for interpolation and other operations where some default background value is needed. Default is 0.
446 def run( 447 self, 448 execution: Execution, 449 ) -> list[str]: 450 """ 451 Build command line arguments. This method is called by the main command. 452 453 Args: 454 execution: The execution object. 455 Returns: 456 Command line arguments 457 """ 458 cargs = [] 459 cargs.extend([ 460 "-background", 461 self.background 462 ]) 463 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
510@dataclasses.dataclass 511class C3dBinarize: 512 """ 513 -binarize: Convert image to binary 514 515 Syntax: `-binarize` 516 517 Converts an image to binary by mapping all background values (the background 518 is 0 by default and can be changed by the option **-background**) to 0 and 519 all non-background values to 1. The **-binarize** command is shorthand for 520 the **-threshold** command. 521 522 c3d test.img -binarize -o binary.img 523 c3d -background 10 -binarize -o binary.img 524 c3d test.img -threshold 10 10 0 1 // equivalent to above command. 525 """ 526 binarize: str 527 """-binarize: Convert image to binary 528 529 Syntax: `-binarize` 530 531 Converts an image to binary by mapping all background values (the background 532 is 0 by default and can be changed by the option **-background**) to 0 and 533 all non-background values to 1. The **-binarize** command is shorthand for 534 the **-threshold** command. 535 536 c3d test.img -binarize -o binary.img 537 c3d -background 10 -binarize -o binary.img 538 c3d test.img -threshold 10 10 0 1 // equivalent to above command""" 539 540 def run( 541 self, 542 execution: Execution, 543 ) -> list[str]: 544 """ 545 Build command line arguments. This method is called by the main command. 546 547 Args: 548 execution: The execution object. 549 Returns: 550 Command line arguments 551 """ 552 cargs = [] 553 cargs.extend([ 554 "-binarize", 555 self.binarize 556 ]) 557 return cargs
-binarize: Convert image to binary
Syntax: -binarize
Converts an image to binary by mapping all background values (the background is 0 by default and can be changed by the option -background) to 0 and all non-background values to 1. The -binarize command is shorthand for the -threshold command.
c3d test.img -binarize -o binary.img c3d -background 10 -binarize -o binary.img c3d test.img -threshold 10 10 0 1 // equivalent to above command.
-binarize: Convert image to binary
Syntax: -binarize
Converts an image to binary by mapping all background values (the background is 0 by default and can be changed by the option -background) to 0 and all non-background values to 1. The -binarize command is shorthand for the -threshold command.
c3d test.img -binarize -o binary.img c3d -background 10 -binarize -o binary.img c3d test.img -threshold 10 10 0 1 // equivalent to above command
540 def run( 541 self, 542 execution: Execution, 543 ) -> list[str]: 544 """ 545 Build command line arguments. This method is called by the main command. 546 547 Args: 548 execution: The execution object. 549 Returns: 550 Command line arguments 551 """ 552 cargs = [] 553 cargs.extend([ 554 "-binarize", 555 self.binarize 556 ]) 557 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
560@dataclasses.dataclass 561class C3dCanny: 562 """ 563 -canny: Canny edge detector 564 565 Syntax: `-canny <sigma_vector> <t_lower> <t_upper>` 566 567 Performs edge detection on the last image on the stack using the Canny 568 filter. The parameters are a vector of standard deviations defining the 569 scale of the edges detected and lower and upper thresholds for edge 570 selection. See documentation on the [ITK Canny Filter][14]. 571 """ 572 canny: str 573 """-canny: Canny edge detector 574 575 Syntax: `-canny <sigma_vector> <t_lower> <t_upper>` 576 577 Performs edge detection on the last image on the stack using the Canny 578 filter. The parameters are a vector of standard deviations defining the 579 scale of the edges detected and lower and upper thresholds for edge 580 selection. See documentation on the [ITK Canny Filter][14].""" 581 582 def run( 583 self, 584 execution: Execution, 585 ) -> list[str]: 586 """ 587 Build command line arguments. This method is called by the main command. 588 589 Args: 590 execution: The execution object. 591 Returns: 592 Command line arguments 593 """ 594 cargs = [] 595 cargs.extend([ 596 "-canny", 597 self.canny 598 ]) 599 return cargs
-canny: Canny edge detector
Syntax: -canny <sigma_vector> <t_lower> <t_upper>
Performs edge detection on the last image on the stack using the Canny filter. The parameters are a vector of standard deviations defining the scale of the edges detected and lower and upper thresholds for edge selection. See documentation on the [ITK Canny Filter][14].
-canny: Canny edge detector
Syntax: -canny <sigma_vector> <t_lower> <t_upper>
Performs edge detection on the last image on the stack using the Canny filter. The parameters are a vector of standard deviations defining the scale of the edges detected and lower and upper thresholds for edge selection. See documentation on the [ITK Canny Filter][14].
582 def run( 583 self, 584 execution: Execution, 585 ) -> list[str]: 586 """ 587 Build command line arguments. This method is called by the main command. 588 589 Args: 590 execution: The execution object. 591 Returns: 592 Command line arguments 593 """ 594 cargs = [] 595 cargs.extend([ 596 "-canny", 597 self.canny 598 ]) 599 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
602@dataclasses.dataclass 603class C3dCeil: 604 """ 605 -ceil: Round up image intensities 606 607 Syntax: `-ceil ` 608 609 Each image intensity is replaced by the smallest integer larger or equal to 610 it 611 612 c3d input.img -ceil -o output.img. 613 """ 614 ceil: str 615 """-ceil: Round up image intensities 616 617 Syntax: `-ceil ` 618 619 Each image intensity is replaced by the smallest integer larger or equal to 620 it 621 622 c3d input.img -ceil -o output.img""" 623 624 def run( 625 self, 626 execution: Execution, 627 ) -> list[str]: 628 """ 629 Build command line arguments. This method is called by the main command. 630 631 Args: 632 execution: The execution object. 633 Returns: 634 Command line arguments 635 """ 636 cargs = [] 637 cargs.extend([ 638 "-ceil", 639 self.ceil 640 ]) 641 return cargs
-ceil: Round up image intensities
Syntax: -ceil
Each image intensity is replaced by the smallest integer larger or equal to it
c3d input.img -ceil -o output.img.
-ceil: Round up image intensities
Syntax: -ceil
Each image intensity is replaced by the smallest integer larger or equal to it
c3d input.img -ceil -o output.img
624 def run( 625 self, 626 execution: Execution, 627 ) -> list[str]: 628 """ 629 Build command line arguments. This method is called by the main command. 630 631 Args: 632 execution: The execution object. 633 Returns: 634 Command line arguments 635 """ 636 cargs = [] 637 cargs.extend([ 638 "-ceil", 639 self.ceil 640 ]) 641 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
644@dataclasses.dataclass 645class C3dCentroid: 646 """ 647 -centroid: Report centroid of foreground voxels 648 649 Syntax: `-centroid` 650 651 Reports the centroid, in physical coordinates, of all foreground voxels in 652 the image. 653 654 c3d binaryimage.img -centroid // centroid of all non-0 voxels 655 c3d grayimage.img -thresh 1000 7000 1 0 -centroid 1 // centroid of all 656 voxels in range 1000-7000 657 c3d labelimage.img -thresh 5 5 1 0 -centroid // centroid of all voxels with 658 label 5 659 c3d labelimage.img -split -foreach -centroid -endfor // centroids of all 660 labels (including 0). 661 """ 662 centroid: str 663 """-centroid: Report centroid of foreground voxels 664 665 Syntax: `-centroid` 666 667 Reports the centroid, in physical coordinates, of all foreground voxels in 668 the image. 669 670 c3d binaryimage.img -centroid // centroid of all non-0 voxels 671 c3d grayimage.img -thresh 1000 7000 1 0 -centroid 1 // centroid of all 672 voxels in range 1000-7000 673 c3d labelimage.img -thresh 5 5 1 0 -centroid // centroid of all voxels with 674 label 5 675 c3d labelimage.img -split -foreach -centroid -endfor // centroids of all 676 labels (including 0)""" 677 678 def run( 679 self, 680 execution: Execution, 681 ) -> list[str]: 682 """ 683 Build command line arguments. This method is called by the main command. 684 685 Args: 686 execution: The execution object. 687 Returns: 688 Command line arguments 689 """ 690 cargs = [] 691 cargs.extend([ 692 "-centroid", 693 self.centroid 694 ]) 695 return cargs
-centroid: Report centroid of foreground voxels
Syntax: -centroid
Reports the centroid, in physical coordinates, of all foreground voxels in the image.
c3d binaryimage.img -centroid // centroid of all non-0 voxels c3d grayimage.img -thresh 1000 7000 1 0 -centroid 1 // centroid of all voxels in range 1000-7000 c3d labelimage.img -thresh 5 5 1 0 -centroid // centroid of all voxels with label 5 c3d labelimage.img -split -foreach -centroid -endfor // centroids of all labels (including 0).
-centroid: Report centroid of foreground voxels
Syntax: -centroid
Reports the centroid, in physical coordinates, of all foreground voxels in the image.
c3d binaryimage.img -centroid // centroid of all non-0 voxels c3d grayimage.img -thresh 1000 7000 1 0 -centroid 1 // centroid of all voxels in range 1000-7000 c3d labelimage.img -thresh 5 5 1 0 -centroid // centroid of all voxels with label 5 c3d labelimage.img -split -foreach -centroid -endfor // centroids of all labels (including 0)
678 def run( 679 self, 680 execution: Execution, 681 ) -> list[str]: 682 """ 683 Build command line arguments. This method is called by the main command. 684 685 Args: 686 execution: The execution object. 687 Returns: 688 Command line arguments 689 """ 690 cargs = [] 691 cargs.extend([ 692 "-centroid", 693 self.centroid 694 ]) 695 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
698@dataclasses.dataclass 699class C3dCentroidMark: 700 """ 701 -centroid-mark: Mark the centroid of foreground voxels 702 703 Syntax: `-centroid-mark <label>` 704 705 Marks the centroid of the foreground voxels in an image. Unlike 706 **-centroid**, this command does not print the centroid location, but marks 707 the closest voxel in the image with the intensity **label**. The remaining 708 voxels are assigned 0 intensity. Combined with -dilate, this can be used to 709 mark centers of regions with spheres. 710 711 c3d binaryimage.nii -centroid-mark -dilate 1 3x3x3 712 c3d labelimage.nii -split -foreach -centroid-mark -endfor -merge -o 713 centers.nii. 714 """ 715 centroid_mark: str 716 """-centroid-mark: Mark the centroid of foreground voxels 717 718 Syntax: `-centroid-mark <label>` 719 720 Marks the centroid of the foreground voxels in an image. Unlike 721 **-centroid**, this command does not print the centroid location, but marks 722 the closest voxel in the image with the intensity **label**. The remaining 723 voxels are assigned 0 intensity. Combined with -dilate, this can be used to 724 mark centers of regions with spheres. 725 726 c3d binaryimage.nii -centroid-mark -dilate 1 3x3x3 727 c3d labelimage.nii -split -foreach -centroid-mark -endfor -merge -o 728 centers.nii""" 729 730 def run( 731 self, 732 execution: Execution, 733 ) -> list[str]: 734 """ 735 Build command line arguments. This method is called by the main command. 736 737 Args: 738 execution: The execution object. 739 Returns: 740 Command line arguments 741 """ 742 cargs = [] 743 cargs.extend([ 744 "-centroid-mark", 745 self.centroid_mark 746 ]) 747 return cargs
-centroid-mark: Mark the centroid of foreground voxels
Syntax: -centroid-mark <label>
Marks the centroid of the foreground voxels in an image. Unlike -centroid, this command does not print the centroid location, but marks the closest voxel in the image with the intensity label. The remaining voxels are assigned 0 intensity. Combined with -dilate, this can be used to mark centers of regions with spheres.
c3d binaryimage.nii -centroid-mark -dilate 1 3x3x3 c3d labelimage.nii -split -foreach -centroid-mark -endfor -merge -o centers.nii.
-centroid-mark: Mark the centroid of foreground voxels
Syntax: -centroid-mark <label>
Marks the centroid of the foreground voxels in an image. Unlike -centroid, this command does not print the centroid location, but marks the closest voxel in the image with the intensity label. The remaining voxels are assigned 0 intensity. Combined with -dilate, this can be used to mark centers of regions with spheres.
c3d binaryimage.nii -centroid-mark -dilate 1 3x3x3 c3d labelimage.nii -split -foreach -centroid-mark -endfor -merge -o centers.nii
730 def run( 731 self, 732 execution: Execution, 733 ) -> list[str]: 734 """ 735 Build command line arguments. This method is called by the main command. 736 737 Args: 738 execution: The execution object. 739 Returns: 740 Command line arguments 741 """ 742 cargs = [] 743 cargs.extend([ 744 "-centroid-mark", 745 self.centroid_mark 746 ]) 747 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
800@dataclasses.dataclass 801class C3dClear: 802 """ 803 -clear: Clear the image stack 804 805 Syntax: `-clear` 806 807 Clears the image stack. Images assigned a name with the **-as** command will 808 remain in memory. 809 """ 810 clear_: str 811 """-clear: Clear the image stack 812 813 Syntax: `-clear` 814 815 Clears the image stack. Images assigned a name with the **-as** command will 816 remain in memory.""" 817 818 def run( 819 self, 820 execution: Execution, 821 ) -> list[str]: 822 """ 823 Build command line arguments. This method is called by the main command. 824 825 Args: 826 execution: The execution object. 827 Returns: 828 Command line arguments 829 """ 830 cargs = [] 831 cargs.extend([ 832 "-clear", 833 self.clear_ 834 ]) 835 return cargs
-clear: Clear the image stack
Syntax: -clear
Clears the image stack. Images assigned a name with the -as command will remain in memory.
-clear: Clear the image stack
Syntax: -clear
Clears the image stack. Images assigned a name with the -as command will remain in memory.
818 def run( 819 self, 820 execution: Execution, 821 ) -> list[str]: 822 """ 823 Build command line arguments. This method is called by the main command. 824 825 Args: 826 execution: The execution object. 827 Returns: 828 Command line arguments 829 """ 830 cargs = [] 831 cargs.extend([ 832 "-clear", 833 self.clear_ 834 ]) 835 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
838@dataclasses.dataclass 839class C3dClip: 840 """ 841 -clip: Clip image intensity to range 842 843 Syntax: `-clip iMin iMax` 844 845 Clips image intensities, so that the values below *iMin* are converted to 846 *iMin* and values greater than *iMax* are converted to *iMax*. This is 847 useful for eliminating hyperintensities in images. Values *iMin* and *iMax* 848 are intensity specifications (see below). 849 850 c3d mri.img -clip 1000 8000 -o mriclip01.img // Clips below and above 851 c3d mri.img -clip -inf 8000 -o mriclip02.img // Clips above only 852 c3d mri.img -clip -inf 95% -o mriclip03.img // Clips at 95th percentile. 853 """ 854 clip: str 855 """-clip: Clip image intensity to range 856 857 Syntax: `-clip iMin iMax` 858 859 Clips image intensities, so that the values below *iMin* are converted to 860 *iMin* and values greater than *iMax* are converted to *iMax*. This is 861 useful for eliminating hyperintensities in images. Values *iMin* and *iMax* 862 are intensity specifications (see below). 863 864 c3d mri.img -clip 1000 8000 -o mriclip01.img // Clips below and above 865 c3d mri.img -clip -inf 8000 -o mriclip02.img // Clips above only 866 c3d mri.img -clip -inf 95% -o mriclip03.img // Clips at 95th percentile""" 867 868 def run( 869 self, 870 execution: Execution, 871 ) -> list[str]: 872 """ 873 Build command line arguments. This method is called by the main command. 874 875 Args: 876 execution: The execution object. 877 Returns: 878 Command line arguments 879 """ 880 cargs = [] 881 cargs.extend([ 882 "-clip", 883 self.clip 884 ]) 885 return cargs
-clip: Clip image intensity to range
Syntax: -clip iMin iMax
Clips image intensities, so that the values below iMin are converted to iMin and values greater than iMax are converted to iMax. This is useful for eliminating hyperintensities in images. Values iMin and iMax are intensity specifications (see below).
c3d mri.img -clip 1000 8000 -o mriclip01.img // Clips below and above c3d mri.img -clip -inf 8000 -o mriclip02.img // Clips above only c3d mri.img -clip -inf 95% -o mriclip03.img // Clips at 95th percentile.
-clip: Clip image intensity to range
Syntax: -clip iMin iMax
Clips image intensities, so that the values below iMin are converted to iMin and values greater than iMax are converted to iMax. This is useful for eliminating hyperintensities in images. Values iMin and iMax are intensity specifications (see below).
c3d mri.img -clip 1000 8000 -o mriclip01.img // Clips below and above c3d mri.img -clip -inf 8000 -o mriclip02.img // Clips above only c3d mri.img -clip -inf 95% -o mriclip03.img // Clips at 95th percentile
868 def run( 869 self, 870 execution: Execution, 871 ) -> list[str]: 872 """ 873 Build command line arguments. This method is called by the main command. 874 875 Args: 876 execution: The execution object. 877 Returns: 878 Command line arguments 879 """ 880 cargs = [] 881 cargs.extend([ 882 "-clip", 883 self.clip 884 ]) 885 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
888@dataclasses.dataclass 889class C3dColorMap: 890 """ 891 -color-map, -colormap: Convert scalar image to RGB using color map 892 893 Syntax: `-color-map <ColormapName> [min max]` 894 895 Converts a scalar image to a color (RGB) image using a specified color map. 896 The output of the command are three images, containing the red, green and 897 blue channels of the RGB image. The mapping uses the range of the input 898 image, e.g., using the **jet** color map, the lowest intensity pixel in the 899 image will be mapped to blue, and the highest intesnity pixel will be mapped 900 to red. The admissible color maps are 901 **hot,cool,spring,summer,autumn,winter,copper,jet,hsv,red,green,blue,grey,overunder**. 902 The command can be used with the -omc command to write RGB images. The 903 example below generates a PNG image from a slice in a scalar image. 904 905 c3d scalar.nii.gz -slice z 50% -flip y -color-map jet -type uchar -omc 906 colorslice.png 907 908 By default the full image intensity range is mapped. The optional **min** 909 and **max** parameters can be used to set the range of the color map. 910 911 c3d scalar.nii.gz -slice z 50% -flip y -color-map jet 0 1 -type uchar -omc 912 colorslice.png. 913 """ 914 color_map: str 915 """-color-map, -colormap: Convert scalar image to RGB using color map 916 917 Syntax: `-color-map <ColormapName> [min max]` 918 919 Converts a scalar image to a color (RGB) image using a specified color map. 920 The output of the command are three images, containing the red, green and 921 blue channels of the RGB image. The mapping uses the range of the input 922 image, e.g., using the **jet** color map, the lowest intensity pixel in the 923 image will be mapped to blue, and the highest intesnity pixel will be mapped 924 to red. The admissible color maps are 925 **hot,cool,spring,summer,autumn,winter,copper,jet,hsv,red,green,blue,grey,overunder**. 926 The command can be used with the -omc command to write RGB images. The 927 example below generates a PNG image from a slice in a scalar image. 928 929 c3d scalar.nii.gz -slice z 50% -flip y -color-map jet -type uchar -omc 930 colorslice.png 931 932 By default the full image intensity range is mapped. The optional **min** 933 and **max** parameters can be used to set the range of the color map. 934 935 c3d scalar.nii.gz -slice z 50% -flip y -color-map jet 0 1 -type uchar -omc 936 colorslice.png""" 937 938 def run( 939 self, 940 execution: Execution, 941 ) -> list[str]: 942 """ 943 Build command line arguments. This method is called by the main command. 944 945 Args: 946 execution: The execution object. 947 Returns: 948 Command line arguments 949 """ 950 cargs = [] 951 cargs.extend([ 952 "-colormap", 953 self.color_map 954 ]) 955 return cargs
-color-map, -colormap: Convert scalar image to RGB using color map
Syntax: -color-map <ColormapName> [min max]
Converts a scalar image to a color (RGB) image using a specified color map. The output of the command are three images, containing the red, green and blue channels of the RGB image. The mapping uses the range of the input image, e.g., using the jet color map, the lowest intensity pixel in the image will be mapped to blue, and the highest intesnity pixel will be mapped to red. The admissible color maps are hot,cool,spring,summer,autumn,winter,copper,jet,hsv,red,green,blue,grey,overunder. The command can be used with the -omc command to write RGB images. The example below generates a PNG image from a slice in a scalar image.
c3d scalar.nii.gz -slice z 50% -flip y -color-map jet -type uchar -omc colorslice.png
By default the full image intensity range is mapped. The optional min and max parameters can be used to set the range of the color map.
c3d scalar.nii.gz -slice z 50% -flip y -color-map jet 0 1 -type uchar -omc colorslice.png.
-color-map, -colormap: Convert scalar image to RGB using color map
Syntax: -color-map <ColormapName> [min max]
Converts a scalar image to a color (RGB) image using a specified color map. The output of the command are three images, containing the red, green and blue channels of the RGB image. The mapping uses the range of the input image, e.g., using the jet color map, the lowest intensity pixel in the image will be mapped to blue, and the highest intesnity pixel will be mapped to red. The admissible color maps are hot,cool,spring,summer,autumn,winter,copper,jet,hsv,red,green,blue,grey,overunder. The command can be used with the -omc command to write RGB images. The example below generates a PNG image from a slice in a scalar image.
c3d scalar.nii.gz -slice z 50% -flip y -color-map jet -type uchar -omc colorslice.png
By default the full image intensity range is mapped. The optional min and max parameters can be used to set the range of the color map.
c3d scalar.nii.gz -slice z 50% -flip y -color-map jet 0 1 -type uchar -omc colorslice.png
938 def run( 939 self, 940 execution: Execution, 941 ) -> list[str]: 942 """ 943 Build command line arguments. This method is called by the main command. 944 945 Args: 946 execution: The execution object. 947 Returns: 948 Command line arguments 949 """ 950 cargs = [] 951 cargs.extend([ 952 "-colormap", 953 self.color_map 954 ]) 955 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
958@dataclasses.dataclass 959class C3dCompress: 960 """ 961 -compress, -no-compress: Enable/disable compression for some image files 962 963 Syntax: `-compress` or `-no-compress` 964 965 Turns on compressing for image file formats that support it. For some file 966 formats, like NIFTI (.nii), compression is enabled automatically when the 967 filename includes the **.gz** extension. For other formats, like MetaImage, 968 you need to specify **-compress** to enable compression. The following two 969 commands save the image as compressed NIFTI and MetaImage files: 970 971 c3d input.nii -o output.nii.gz 972 c3d input.nii -compress -o output.mha. 973 """ 974 compress: str 975 """-compress, -no-compress: Enable/disable compression for some image files 976 977 Syntax: `-compress` or `-no-compress` 978 979 Turns on compressing for image file formats that support it. For some file 980 formats, like NIFTI (.nii), compression is enabled automatically when the 981 filename includes the **.gz** extension. For other formats, like MetaImage, 982 you need to specify **-compress** to enable compression. The following two 983 commands save the image as compressed NIFTI and MetaImage files: 984 985 c3d input.nii -o output.nii.gz 986 c3d input.nii -compress -o output.mha""" 987 988 def run( 989 self, 990 execution: Execution, 991 ) -> list[str]: 992 """ 993 Build command line arguments. This method is called by the main command. 994 995 Args: 996 execution: The execution object. 997 Returns: 998 Command line arguments 999 """ 1000 cargs = [] 1001 cargs.extend([ 1002 "-compress", 1003 self.compress 1004 ]) 1005 return cargs
-compress, -no-compress: Enable/disable compression for some image files
Syntax: -compress or -no-compress
Turns on compressing for image file formats that support it. For some file formats, like NIFTI (.nii), compression is enabled automatically when the filename includes the .gz extension. For other formats, like MetaImage, you need to specify -compress to enable compression. The following two commands save the image as compressed NIFTI and MetaImage files:
c3d input.nii -o output.nii.gz c3d input.nii -compress -o output.mha.
-compress, -no-compress: Enable/disable compression for some image files
Syntax: -compress or -no-compress
Turns on compressing for image file formats that support it. For some file formats, like NIFTI (.nii), compression is enabled automatically when the filename includes the .gz extension. For other formats, like MetaImage, you need to specify -compress to enable compression. The following two commands save the image as compressed NIFTI and MetaImage files:
c3d input.nii -o output.nii.gz c3d input.nii -compress -o output.mha
988 def run( 989 self, 990 execution: Execution, 991 ) -> list[str]: 992 """ 993 Build command line arguments. This method is called by the main command. 994 995 Args: 996 execution: The execution object. 997 Returns: 998 Command line arguments 999 """ 1000 cargs = [] 1001 cargs.extend([ 1002 "-compress", 1003 self.compress 1004 ]) 1005 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
750@dataclasses.dataclass 751class C3dConnectedComponents: 752 """ 753 -comp, -connected-components: Compute connected components 754 755 Syntax: `-comp` 756 757 Computes the connected components of a binary image. Each connected 758 component is assigned an integer index. Indices are ordered by the size of 759 the component, so the component assigned index 1 is the largest. The 760 background is assigned index 0. To select the largest connected component, 761 combine the call to **-comp** with a call to **-threshold**. 762 763 c3d binary.img -comp -o comp.img 764 c3d binary.img -comp -threshold 1 1 1 0 -o largest_comp.img. 765 """ 766 connected_components: str 767 """-comp, -connected-components: Compute connected components 768 769 Syntax: `-comp` 770 771 Computes the connected components of a binary image. Each connected 772 component is assigned an integer index. Indices are ordered by the size of 773 the component, so the component assigned index 1 is the largest. The 774 background is assigned index 0. To select the largest connected component, 775 combine the call to **-comp** with a call to **-threshold**. 776 777 c3d binary.img -comp -o comp.img 778 c3d binary.img -comp -threshold 1 1 1 0 -o largest_comp.img""" 779 780 def run( 781 self, 782 execution: Execution, 783 ) -> list[str]: 784 """ 785 Build command line arguments. This method is called by the main command. 786 787 Args: 788 execution: The execution object. 789 Returns: 790 Command line arguments 791 """ 792 cargs = [] 793 cargs.extend([ 794 "-connected-components", 795 self.connected_components 796 ]) 797 return cargs
-comp, -connected-components: Compute connected components
Syntax: -comp
Computes the connected components of a binary image. Each connected component is assigned an integer index. Indices are ordered by the size of the component, so the component assigned index 1 is the largest. The background is assigned index 0. To select the largest connected component, combine the call to -comp with a call to -threshold.
c3d binary.img -comp -o comp.img c3d binary.img -comp -threshold 1 1 1 0 -o largest_comp.img.
-comp, -connected-components: Compute connected components
Syntax: -comp
Computes the connected components of a binary image. Each connected component is assigned an integer index. Indices are ordered by the size of the component, so the component assigned index 1 is the largest. The background is assigned index 0. To select the largest connected component, combine the call to -comp with a call to -threshold.
c3d binary.img -comp -o comp.img c3d binary.img -comp -threshold 1 1 1 0 -o largest_comp.img
780 def run( 781 self, 782 execution: Execution, 783 ) -> list[str]: 784 """ 785 Build command line arguments. This method is called by the main command. 786 787 Args: 788 execution: The execution object. 789 Returns: 790 Command line arguments 791 """ 792 cargs = [] 793 cargs.extend([ 794 "-connected-components", 795 self.connected_components 796 ]) 797 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1058@dataclasses.dataclass 1059class C3dConv: 1060 """ 1061 -conv: Convolution 1062 1063 Syntax `-conv` 1064 1065 Performs convolution between the last two images on the stack. The 1066 convolution is performed using the Fourier transform. The result is an image 1067 of the same dimensions as the first image. For more details, see ["FFT Based 1068 Convolution" by Gaetan Lehmann][Lehmann]. 1069 1070 c3d image.nii kernel.nii -conv -o result.nii 1071 1072 1073 [Lehmann]: https://hdl.handle.net/10380/3154. 1074 """ 1075 conv: str 1076 """-conv: Convolution 1077 1078 Syntax `-conv` 1079 1080 Performs convolution between the last two images on the stack. The 1081 convolution is performed using the Fourier transform. The result is an image 1082 of the same dimensions as the first image. For more details, see ["FFT Based 1083 Convolution" by Gaetan Lehmann][Lehmann]. 1084 1085 c3d image.nii kernel.nii -conv -o result.nii 1086 1087 1088 [Lehmann]: https://hdl.handle.net/10380/3154""" 1089 1090 def run( 1091 self, 1092 execution: Execution, 1093 ) -> list[str]: 1094 """ 1095 Build command line arguments. This method is called by the main command. 1096 1097 Args: 1098 execution: The execution object. 1099 Returns: 1100 Command line arguments 1101 """ 1102 cargs = [] 1103 cargs.extend([ 1104 "-conv", 1105 self.conv 1106 ]) 1107 return cargs
-conv: Convolution
Syntax -conv
Performs convolution between the last two images on the stack. The convolution is performed using the Fourier transform. The result is an image of the same dimensions as the first image. For more details, see "FFT Based Convolution" by Gaetan Lehmann.
c3d image.nii kernel.nii -conv -o result.nii
-conv: Convolution
Syntax -conv
Performs convolution between the last two images on the stack. The convolution is performed using the Fourier transform. The result is an image of the same dimensions as the first image. For more details, see "FFT Based Convolution" by Gaetan Lehmann.
c3d image.nii kernel.nii -conv -o result.nii
1090 def run( 1091 self, 1092 execution: Execution, 1093 ) -> list[str]: 1094 """ 1095 Build command line arguments. This method is called by the main command. 1096 1097 Args: 1098 execution: The execution object. 1099 Returns: 1100 Command line arguments 1101 """ 1102 cargs = [] 1103 cargs.extend([ 1104 "-conv", 1105 self.conv 1106 ]) 1107 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1172@dataclasses.dataclass 1173class C3dCoordinateMapPhysical: 1174 """ 1175 -cmp, -coordinate-map-physical: Generate voxel coordinate maps (voxel units) 1176 1177 Syntax: `-cmp` 1178 1179 This command is similar to **-cmv** (**-coordinate-map-voxel**), but the 1180 output will contain the physical coordinates of the voxels, in the NIFTI 1181 (RAS) coordinate frame. 1182 """ 1183 coordinate_map_physical: str 1184 """-cmp, -coordinate-map-physical: Generate voxel coordinate maps (voxel 1185 units) 1186 1187 Syntax: `-cmp` 1188 1189 This command is similar to **-cmv** (**-coordinate-map-voxel**), but the 1190 output will contain the physical coordinates of the voxels, in the NIFTI 1191 (RAS) coordinate frame.""" 1192 1193 def run( 1194 self, 1195 execution: Execution, 1196 ) -> list[str]: 1197 """ 1198 Build command line arguments. This method is called by the main command. 1199 1200 Args: 1201 execution: The execution object. 1202 Returns: 1203 Command line arguments 1204 """ 1205 cargs = [] 1206 cargs.extend([ 1207 "-coordinate-map-physical", 1208 self.coordinate_map_physical 1209 ]) 1210 return cargs
-cmp, -coordinate-map-physical: Generate voxel coordinate maps (voxel units)
Syntax: -cmp
This command is similar to -cmv (-coordinate-map-voxel), but the output will contain the physical coordinates of the voxels, in the NIFTI (RAS) coordinate frame.
-cmp, -coordinate-map-physical: Generate voxel coordinate maps (voxel units)
Syntax: -cmp
This command is similar to -cmv (-coordinate-map-voxel), but the output will contain the physical coordinates of the voxels, in the NIFTI (RAS) coordinate frame.
1193 def run( 1194 self, 1195 execution: Execution, 1196 ) -> list[str]: 1197 """ 1198 Build command line arguments. This method is called by the main command. 1199 1200 Args: 1201 execution: The execution object. 1202 Returns: 1203 Command line arguments 1204 """ 1205 cargs = [] 1206 cargs.extend([ 1207 "-coordinate-map-physical", 1208 self.coordinate_map_physical 1209 ]) 1210 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1110@dataclasses.dataclass 1111class C3dCoordinateMapVoxel: 1112 """ 1113 -cmv, -coordinate-map-voxel: Generate voxel coordinate maps (voxel units) 1114 1115 Syntax: `-cmv` 1116 1117 For a *N*-dimensional image, replaces the last image on the stack with *N* 1118 images. The *k*-th output image at each voxel contains the $k$-th coordinate 1119 of that voxel, in voxel units. 1120 1121 c3d image.nii -cmv -oo coordmap%d.nii.gz 1122 1123 One can use this command to split a brain segmentation image into a left 1124 hemisphere segmentation and a right hemisphere segmentation (assuming the X 1125 coordinate corresponds to the right-left axis) 1126 1127 c3d seg.nii -as SEG -cmv -pop -pop -thresh 50% inf 1 0 -as MASK \ 1128 -push SEG -times -o seg_left.nii.gz \ 1129 -push MASK -replace 1 0 0 1 \ 1130 -push SEG -times -o seg_right.nii.gz. 1131 """ 1132 coordinate_map_voxel: str 1133 """-cmv, -coordinate-map-voxel: Generate voxel coordinate maps (voxel units) 1134 1135 Syntax: `-cmv` 1136 1137 For a *N*-dimensional image, replaces the last image on the stack with *N* 1138 images. The *k*-th output image at each voxel contains the $k$-th coordinate 1139 of that voxel, in voxel units. 1140 1141 c3d image.nii -cmv -oo coordmap%d.nii.gz 1142 1143 One can use this command to split a brain segmentation image into a left 1144 hemisphere segmentation and a right hemisphere segmentation (assuming the X 1145 coordinate corresponds to the right-left axis) 1146 1147 c3d seg.nii -as SEG -cmv -pop -pop -thresh 50% inf 1 0 -as MASK \ 1148 -push SEG -times -o seg_left.nii.gz \ 1149 -push MASK -replace 1 0 0 1 \ 1150 -push SEG -times -o seg_right.nii.gz""" 1151 1152 def run( 1153 self, 1154 execution: Execution, 1155 ) -> list[str]: 1156 """ 1157 Build command line arguments. This method is called by the main command. 1158 1159 Args: 1160 execution: The execution object. 1161 Returns: 1162 Command line arguments 1163 """ 1164 cargs = [] 1165 cargs.extend([ 1166 "-coordinate-map-voxel", 1167 self.coordinate_map_voxel 1168 ]) 1169 return cargs
-cmv, -coordinate-map-voxel: Generate voxel coordinate maps (voxel units)
Syntax: -cmv
For a N-dimensional image, replaces the last image on the stack with N images. The k-th output image at each voxel contains the $k$-th coordinate of that voxel, in voxel units.
c3d image.nii -cmv -oo coordmap%d.nii.gz
One can use this command to split a brain segmentation image into a left hemisphere segmentation and a right hemisphere segmentation (assuming the X coordinate corresponds to the right-left axis)
c3d seg.nii -as SEG -cmv -pop -pop -thresh 50% inf 1 0 -as MASK -push SEG -times -o seg_left.nii.gz -push MASK -replace 1 0 0 1 -push SEG -times -o seg_right.nii.gz.
-cmv, -coordinate-map-voxel: Generate voxel coordinate maps (voxel units)
Syntax: -cmv
For a N-dimensional image, replaces the last image on the stack with N images. The k-th output image at each voxel contains the $k$-th coordinate of that voxel, in voxel units.
c3d image.nii -cmv -oo coordmap%d.nii.gz
One can use this command to split a brain segmentation image into a left hemisphere segmentation and a right hemisphere segmentation (assuming the X coordinate corresponds to the right-left axis)
c3d seg.nii -as SEG -cmv -pop -pop -thresh 50% inf 1 0 -as MASK -push SEG -times -o seg_left.nii.gz -push MASK -replace 1 0 0 1 -push SEG -times -o seg_right.nii.gz
1152 def run( 1153 self, 1154 execution: Execution, 1155 ) -> list[str]: 1156 """ 1157 Build command line arguments. This method is called by the main command. 1158 1159 Args: 1160 execution: The execution object. 1161 Returns: 1162 Command line arguments 1163 """ 1164 cargs = [] 1165 cargs.extend([ 1166 "-coordinate-map-voxel", 1167 self.coordinate_map_voxel 1168 ]) 1169 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1213@dataclasses.dataclass 1214class C3dCopyTransform: 1215 """ 1216 -copy-transform: Copy header information 1217 1218 Syntax: `-copy-transform` 1219 1220 Copies the image header, specifically the image to physical space transform 1221 (origin, spacing, direction cosines), from the first image (reference) to 1222 the second image (target). This is best done with NIFTI images, which store 1223 this information well. In the example below, *out.nii* will have the same 1224 header as *first.nii* and the same intensities as *second.nii*. 1225 1226 c3d first.nii second.nii -copy-transform -o out.nii. 1227 """ 1228 copy_transform: str 1229 """-copy-transform: Copy header information 1230 1231 Syntax: `-copy-transform` 1232 1233 Copies the image header, specifically the image to physical space transform 1234 (origin, spacing, direction cosines), from the first image (reference) to 1235 the second image (target). This is best done with NIFTI images, which store 1236 this information well. In the example below, *out.nii* will have the same 1237 header as *first.nii* and the same intensities as *second.nii*. 1238 1239 c3d first.nii second.nii -copy-transform -o out.nii""" 1240 1241 def run( 1242 self, 1243 execution: Execution, 1244 ) -> list[str]: 1245 """ 1246 Build command line arguments. This method is called by the main command. 1247 1248 Args: 1249 execution: The execution object. 1250 Returns: 1251 Command line arguments 1252 """ 1253 cargs = [] 1254 cargs.extend([ 1255 "-copy-transform", 1256 self.copy_transform 1257 ]) 1258 return cargs
-copy-transform: Copy header information
Syntax: -copy-transform
Copies the image header, specifically the image to physical space transform (origin, spacing, direction cosines), from the first image (reference) to the second image (target). This is best done with NIFTI images, which store this information well. In the example below, out.nii will have the same header as first.nii and the same intensities as second.nii.
c3d first.nii second.nii -copy-transform -o out.nii.
-copy-transform: Copy header information
Syntax: -copy-transform
Copies the image header, specifically the image to physical space transform (origin, spacing, direction cosines), from the first image (reference) to the second image (target). This is best done with NIFTI images, which store this information well. In the example below, out.nii will have the same header as first.nii and the same intensities as second.nii.
c3d first.nii second.nii -copy-transform -o out.nii
1241 def run( 1242 self, 1243 execution: Execution, 1244 ) -> list[str]: 1245 """ 1246 Build command line arguments. This method is called by the main command. 1247 1248 Args: 1249 execution: The execution object. 1250 Returns: 1251 Command line arguments 1252 """ 1253 cargs = [] 1254 cargs.extend([ 1255 "-copy-transform", 1256 self.copy_transform 1257 ]) 1258 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1261@dataclasses.dataclass 1262class C3dCos: 1263 """ 1264 No description found. 1265 """ 1266 cos: str 1267 """No description found.""" 1268 1269 def run( 1270 self, 1271 execution: Execution, 1272 ) -> list[str]: 1273 """ 1274 Build command line arguments. This method is called by the main command. 1275 1276 Args: 1277 execution: The execution object. 1278 Returns: 1279 Command line arguments 1280 """ 1281 cargs = [] 1282 cargs.extend([ 1283 "-cos", 1284 self.cos 1285 ]) 1286 return cargs
No description found.
1269 def run( 1270 self, 1271 execution: Execution, 1272 ) -> list[str]: 1273 """ 1274 Build command line arguments. This method is called by the main command. 1275 1276 Args: 1277 execution: The execution object. 1278 Returns: 1279 Command line arguments 1280 """ 1281 cargs = [] 1282 cargs.extend([ 1283 "-cos", 1284 self.cos 1285 ]) 1286 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1289@dataclasses.dataclass 1290class C3dCreate: 1291 """ 1292 -create: Generate blank image 1293 1294 Syntax: `-create dimensions voxel_size` 1295 1296 Creates a new blank image with specified dimensions and voxel size, and 1297 places it at the end of the stack. The image is set to the current 1298 background value, which is 0 by default but can be overwritten with the 1299 **-background** command. The origin of the image can be changed with the 1300 **-origin** command. 1301 1302 c3d -create 256x256x160 1x1x1mm -o newimage.img 1303 c3d -background 128 -create 256x256x160 1x1x1mm -origin 128x128x80mm -o 1304 newimage.img. 1305 """ 1306 create: str 1307 """-create: Generate blank image 1308 1309 Syntax: `-create dimensions voxel_size` 1310 1311 Creates a new blank image with specified dimensions and voxel size, and 1312 places it at the end of the stack. The image is set to the current 1313 background value, which is 0 by default but can be overwritten with the 1314 **-background** command. The origin of the image can be changed with the 1315 **-origin** command. 1316 1317 c3d -create 256x256x160 1x1x1mm -o newimage.img 1318 c3d -background 128 -create 256x256x160 1x1x1mm -origin 128x128x80mm -o 1319 newimage.img""" 1320 1321 def run( 1322 self, 1323 execution: Execution, 1324 ) -> list[str]: 1325 """ 1326 Build command line arguments. This method is called by the main command. 1327 1328 Args: 1329 execution: The execution object. 1330 Returns: 1331 Command line arguments 1332 """ 1333 cargs = [] 1334 cargs.extend([ 1335 "-create", 1336 self.create 1337 ]) 1338 return cargs
-create: Generate blank image
Syntax: -create dimensions voxel_size
Creates a new blank image with specified dimensions and voxel size, and places it at the end of the stack. The image is set to the current background value, which is 0 by default but can be overwritten with the -background command. The origin of the image can be changed with the -origin command.
c3d -create 256x256x160 1x1x1mm -o newimage.img c3d -background 128 -create 256x256x160 1x1x1mm -origin 128x128x80mm -o newimage.img.
-create: Generate blank image
Syntax: -create dimensions voxel_size
Creates a new blank image with specified dimensions and voxel size, and places it at the end of the stack. The image is set to the current background value, which is 0 by default but can be overwritten with the -background command. The origin of the image can be changed with the -origin command.
c3d -create 256x256x160 1x1x1mm -o newimage.img c3d -background 128 -create 256x256x160 1x1x1mm -origin 128x128x80mm -o newimage.img
1321 def run( 1322 self, 1323 execution: Execution, 1324 ) -> list[str]: 1325 """ 1326 Build command line arguments. This method is called by the main command. 1327 1328 Args: 1329 execution: The execution object. 1330 Returns: 1331 Command line arguments 1332 """ 1333 cargs = [] 1334 cargs.extend([ 1335 "-create", 1336 self.create 1337 ]) 1338 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1341@dataclasses.dataclass 1342class C3dDicomSeriesList: 1343 """ 1344 -dicom-series-list: List image series in a DICOM directory 1345 1346 Syntax: `-dicom-series-list <directory> 1347 1348 Prints out a table of DICOM series ids and corresponding image information 1349 to standard output. 1350 """ 1351 dicom_series_list: str 1352 """-dicom-series-list: List image series in a DICOM directory 1353 1354 Syntax: `-dicom-series-list <directory> 1355 1356 Prints out a table of DICOM series ids and corresponding image information 1357 to standard output.""" 1358 1359 def run( 1360 self, 1361 execution: Execution, 1362 ) -> list[str]: 1363 """ 1364 Build command line arguments. This method is called by the main command. 1365 1366 Args: 1367 execution: The execution object. 1368 Returns: 1369 Command line arguments 1370 """ 1371 cargs = [] 1372 cargs.extend([ 1373 "-dicom-series-list", 1374 self.dicom_series_list 1375 ]) 1376 return cargs
-dicom-series-list: List image series in a DICOM directory
Syntax: `-dicom-series-list
Prints out a table of DICOM series ids and corresponding image information to standard output.
-dicom-series-list: List image series in a DICOM directory
Syntax: `-dicom-series-list
Prints out a table of DICOM series ids and corresponding image information to standard output.
1359 def run( 1360 self, 1361 execution: Execution, 1362 ) -> list[str]: 1363 """ 1364 Build command line arguments. This method is called by the main command. 1365 1366 Args: 1367 execution: The execution object. 1368 Returns: 1369 Command line arguments 1370 """ 1371 cargs = [] 1372 cargs.extend([ 1373 "-dicom-series-list", 1374 self.dicom_series_list 1375 ]) 1376 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1379@dataclasses.dataclass 1380class C3dDicomSeriesRead: 1381 """ 1382 -dicom-series-read: Read a DICOM image series 1383 1384 Syntax: `-dicom-series-read <directory> <series_id>` 1385 1386 Imports a specific DICOM image series from a directory containing DICOM 1387 files. The **directory** parameter may also point to one of the DICOM files 1388 in the directory. 1389 The **seried_id** is a string identifier for the series that can be obtained 1390 by calling **-dicom-series-list**. 1391 """ 1392 dicom_series_read: str 1393 """-dicom-series-read: Read a DICOM image series 1394 1395 Syntax: `-dicom-series-read <directory> <series_id>` 1396 1397 Imports a specific DICOM image series from a directory containing DICOM 1398 files. The **directory** parameter may also point to one of the DICOM files 1399 in the directory. 1400 The **seried_id** is a string identifier for the series that can be obtained 1401 by calling **-dicom-series-list**""" 1402 1403 def run( 1404 self, 1405 execution: Execution, 1406 ) -> list[str]: 1407 """ 1408 Build command line arguments. This method is called by the main command. 1409 1410 Args: 1411 execution: The execution object. 1412 Returns: 1413 Command line arguments 1414 """ 1415 cargs = [] 1416 cargs.extend([ 1417 "-dicom-series-read", 1418 self.dicom_series_read 1419 ]) 1420 return cargs
-dicom-series-read: Read a DICOM image series
Syntax: -dicom-series-read <directory> <series_id>
Imports a specific DICOM image series from a directory containing DICOM files. The directory parameter may also point to one of the DICOM files in the directory. The seried_id is a string identifier for the series that can be obtained by calling -dicom-series-list.
-dicom-series-read: Read a DICOM image series
Syntax: -dicom-series-read <directory> <series_id>
Imports a specific DICOM image series from a directory containing DICOM files. The directory parameter may also point to one of the DICOM files in the directory. The seried_id is a string identifier for the series that can be obtained by calling -dicom-series-list
1403 def run( 1404 self, 1405 execution: Execution, 1406 ) -> list[str]: 1407 """ 1408 Build command line arguments. This method is called by the main command. 1409 1410 Args: 1411 execution: The execution object. 1412 Returns: 1413 Command line arguments 1414 """ 1415 cargs = [] 1416 cargs.extend([ 1417 "-dicom-series-read", 1418 self.dicom_series_read 1419 ]) 1420 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1423@dataclasses.dataclass 1424class C3dDilate: 1425 """ 1426 -dilate: Binary dilation 1427 1428 Syntax: `-dilate <label> <radius_vector>` 1429 1430 Applies the dilation [mathematical morphology][5] operation to a binary 1431 image. The first parameter is the intensity value of the object that is to 1432 be dilated. The second is the radius of the dilation structuring element in 1433 3D. 1434 1435 c3d binary.img -dilate 255 3x3x3vox -o newimage.img. 1436 """ 1437 dilate: str 1438 """-dilate: Binary dilation 1439 1440 Syntax: `-dilate <label> <radius_vector>` 1441 1442 Applies the dilation [mathematical morphology][5] operation to a binary 1443 image. The first parameter is the intensity value of the object that is to 1444 be dilated. The second is the radius of the dilation structuring element in 1445 3D. 1446 1447 c3d binary.img -dilate 255 3x3x3vox -o newimage.img""" 1448 1449 def run( 1450 self, 1451 execution: Execution, 1452 ) -> list[str]: 1453 """ 1454 Build command line arguments. This method is called by the main command. 1455 1456 Args: 1457 execution: The execution object. 1458 Returns: 1459 Command line arguments 1460 """ 1461 cargs = [] 1462 cargs.extend([ 1463 "-dilate", 1464 self.dilate 1465 ]) 1466 return cargs
-dilate: Binary dilation
Syntax: -dilate <label> <radius_vector>
Applies the dilation [mathematical morphology][5] operation to a binary image. The first parameter is the intensity value of the object that is to be dilated. The second is the radius of the dilation structuring element in 3D.
c3d binary.img -dilate 255 3x3x3vox -o newimage.img.
-dilate: Binary dilation
Syntax: -dilate <label> <radius_vector>
Applies the dilation [mathematical morphology][5] operation to a binary image. The first parameter is the intensity value of the object that is to be dilated. The second is the radius of the dilation structuring element in 3D.
c3d binary.img -dilate 255 3x3x3vox -o newimage.img
1449 def run( 1450 self, 1451 execution: Execution, 1452 ) -> list[str]: 1453 """ 1454 Build command line arguments. This method is called by the main command. 1455 1456 Args: 1457 execution: The execution object. 1458 Returns: 1459 Command line arguments 1460 """ 1461 cargs = [] 1462 cargs.extend([ 1463 "-dilate", 1464 self.dilate 1465 ]) 1466 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1469@dataclasses.dataclass 1470class C3dDivide: 1471 """ 1472 -divide: Voxelwise image division 1473 1474 Syntax: `-divide` 1475 1476 Divides one image by another. For instance to compute C = A / B, use the 1477 command 1478 1479 c3d A.img B.img -divide -o C.img 1480 1481 Divison may generate infinite and not-a-number (NaN) values if B contains 1482 zeros. You can use **-replace** to get rid of these values 1483 1484 c3d A.img B.img -divide -replace inf 1000 -inf -1000 NaN 0 -o C2.img. 1485 """ 1486 divide: str 1487 """-divide: Voxelwise image division 1488 1489 Syntax: `-divide` 1490 1491 Divides one image by another. For instance to compute C = A / B, use the 1492 command 1493 1494 c3d A.img B.img -divide -o C.img 1495 1496 Divison may generate infinite and not-a-number (NaN) values if B contains 1497 zeros. You can use **-replace** to get rid of these values 1498 1499 c3d A.img B.img -divide -replace inf 1000 -inf -1000 NaN 0 -o C2.img""" 1500 1501 def run( 1502 self, 1503 execution: Execution, 1504 ) -> list[str]: 1505 """ 1506 Build command line arguments. This method is called by the main command. 1507 1508 Args: 1509 execution: The execution object. 1510 Returns: 1511 Command line arguments 1512 """ 1513 cargs = [] 1514 cargs.extend([ 1515 "-divide", 1516 self.divide 1517 ]) 1518 return cargs
-divide: Voxelwise image division
Syntax: -divide
Divides one image by another. For instance to compute C = A / B, use the command
c3d A.img B.img -divide -o C.img
Divison may generate infinite and not-a-number (NaN) values if B contains zeros. You can use -replace to get rid of these values
c3d A.img B.img -divide -replace inf 1000 -inf -1000 NaN 0 -o C2.img.
-divide: Voxelwise image division
Syntax: -divide
Divides one image by another. For instance to compute C = A / B, use the command
c3d A.img B.img -divide -o C.img
Divison may generate infinite and not-a-number (NaN) values if B contains zeros. You can use -replace to get rid of these values
c3d A.img B.img -divide -replace inf 1000 -inf -1000 NaN 0 -o C2.img
1501 def run( 1502 self, 1503 execution: Execution, 1504 ) -> list[str]: 1505 """ 1506 Build command line arguments. This method is called by the main command. 1507 1508 Args: 1509 execution: The execution object. 1510 Returns: 1511 Command line arguments 1512 """ 1513 cargs = [] 1514 cargs.extend([ 1515 "-divide", 1516 self.divide 1517 ]) 1518 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1521@dataclasses.dataclass 1522class C3dDuplicate: 1523 """ 1524 -dup: Duplicate the last image on the stack 1525 1526 Syntax: `-dup` 1527 1528 Duplicates the image at the end of the stack. This is equivalent to **-as 1529 var -push var**, but shorter. An example is when you want to pass an image 1530 as both arguments to a binary operator, e.g., computing the square of the 1531 image intensity: 1532 1533 c3d input.img -dup -times -o square.img 1534 1535 ### Commands: Voxelwise Calculations. 1536 """ 1537 duplicate: str 1538 """-dup: Duplicate the last image on the stack 1539 1540 Syntax: `-dup` 1541 1542 Duplicates the image at the end of the stack. This is equivalent to **-as 1543 var -push var**, but shorter. An example is when you want to pass an image 1544 as both arguments to a binary operator, e.g., computing the square of the 1545 image intensity: 1546 1547 c3d input.img -dup -times -o square.img 1548 1549 ### Commands: Voxelwise Calculations""" 1550 1551 def run( 1552 self, 1553 execution: Execution, 1554 ) -> list[str]: 1555 """ 1556 Build command line arguments. This method is called by the main command. 1557 1558 Args: 1559 execution: The execution object. 1560 Returns: 1561 Command line arguments 1562 """ 1563 cargs = [] 1564 cargs.extend([ 1565 "-dup", 1566 self.duplicate 1567 ]) 1568 return cargs
-dup: Duplicate the last image on the stack
Syntax: -dup
Duplicates the image at the end of the stack. This is equivalent to -as var -push var, but shorter. An example is when you want to pass an image as both arguments to a binary operator, e.g., computing the square of the image intensity:
c3d input.img -dup -times -o square.img
Commands: Voxelwise Calculations.
-dup: Duplicate the last image on the stack
Syntax: -dup
Duplicates the image at the end of the stack. This is equivalent to -as var -push var, but shorter. An example is when you want to pass an image as both arguments to a binary operator, e.g., computing the square of the image intensity:
c3d input.img -dup -times -o square.img
Commands: Voxelwise Calculations
1551 def run( 1552 self, 1553 execution: Execution, 1554 ) -> list[str]: 1555 """ 1556 Build command line arguments. This method is called by the main command. 1557 1558 Args: 1559 execution: The execution object. 1560 Returns: 1561 Command line arguments 1562 """ 1563 cargs = [] 1564 cargs.extend([ 1565 "-dup", 1566 self.duplicate 1567 ]) 1568 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1571@dataclasses.dataclass 1572class C3dEndaccum: 1573 """ 1574 -accum, -endaccum: Accumulate operations over all images 1575 1576 Syntax: `-accum command-list -endaccum` 1577 1578 Apply a binary operation (such as addition or multiplication) to all the 1579 images on the stack in a cumulative fashion. The command(s) will be applied 1580 to the last and second-to-last images on the stack, then to the result of 1581 this operation and the third-to-last image on the stack and so on. Below is 1582 the example of using the command to add multiple images. 1583 1584 c3d image*.nii -accum -add -endaccum -o sum.nii. 1585 """ 1586 endaccum: str 1587 """-accum, -endaccum: Accumulate operations over all images 1588 1589 Syntax: `-accum command-list -endaccum` 1590 1591 Apply a binary operation (such as addition or multiplication) to all the 1592 images on the stack in a cumulative fashion. The command(s) will be applied 1593 to the last and second-to-last images on the stack, then to the result of 1594 this operation and the third-to-last image on the stack and so on. Below is 1595 the example of using the command to add multiple images. 1596 1597 c3d image*.nii -accum -add -endaccum -o sum.nii""" 1598 1599 def run( 1600 self, 1601 execution: Execution, 1602 ) -> list[str]: 1603 """ 1604 Build command line arguments. This method is called by the main command. 1605 1606 Args: 1607 execution: The execution object. 1608 Returns: 1609 Command line arguments 1610 """ 1611 cargs = [] 1612 cargs.extend([ 1613 "-endaccum", 1614 self.endaccum 1615 ]) 1616 return cargs
-accum, -endaccum: Accumulate operations over all images
Syntax: -accum command-list -endaccum
Apply a binary operation (such as addition or multiplication) to all the images on the stack in a cumulative fashion. The command(s) will be applied to the last and second-to-last images on the stack, then to the result of this operation and the third-to-last image on the stack and so on. Below is the example of using the command to add multiple images.
c3d image*.nii -accum -add -endaccum -o sum.nii.
-accum, -endaccum: Accumulate operations over all images
Syntax: -accum command-list -endaccum
Apply a binary operation (such as addition or multiplication) to all the images on the stack in a cumulative fashion. The command(s) will be applied to the last and second-to-last images on the stack, then to the result of this operation and the third-to-last image on the stack and so on. Below is the example of using the command to add multiple images.
c3d image*.nii -accum -add -endaccum -o sum.nii
1599 def run( 1600 self, 1601 execution: Execution, 1602 ) -> list[str]: 1603 """ 1604 Build command line arguments. This method is called by the main command. 1605 1606 Args: 1607 execution: The execution object. 1608 Returns: 1609 Command line arguments 1610 """ 1611 cargs = [] 1612 cargs.extend([ 1613 "-endaccum", 1614 self.endaccum 1615 ]) 1616 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1619@dataclasses.dataclass 1620class C3dEndfor: 1621 """ 1622 -foreach, -endfor: Loop commands over all images on the stack 1623 1624 Syntax: `-foreach commands-list -endfor` 1625 1626 This command forces the commands between **-foreach** and **-endfor** to be 1627 applied to every image on the stack. The main use of this command is to 1628 automate processing of multiple datasets. For example, 1629 1630 c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii. 1631 """ 1632 endfor: str 1633 """-foreach, -endfor: Loop commands over all images on the stack 1634 1635 Syntax: `-foreach commands-list -endfor` 1636 1637 This command forces the commands between **-foreach** and **-endfor** to be 1638 applied to every image on the stack. The main use of this command is to 1639 automate processing of multiple datasets. For example, 1640 1641 c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii""" 1642 1643 def run( 1644 self, 1645 execution: Execution, 1646 ) -> list[str]: 1647 """ 1648 Build command line arguments. This method is called by the main command. 1649 1650 Args: 1651 execution: The execution object. 1652 Returns: 1653 Command line arguments 1654 """ 1655 cargs = [] 1656 cargs.extend([ 1657 "-endfor", 1658 self.endfor 1659 ]) 1660 return cargs
-foreach, -endfor: Loop commands over all images on the stack
Syntax: -foreach commands-list -endfor
This command forces the commands between -foreach and -endfor to be applied to every image on the stack. The main use of this command is to automate processing of multiple datasets. For example,
c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii.
-foreach, -endfor: Loop commands over all images on the stack
Syntax: -foreach commands-list -endfor
This command forces the commands between -foreach and -endfor to be applied to every image on the stack. The main use of this command is to automate processing of multiple datasets. For example,
c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii
1643 def run( 1644 self, 1645 execution: Execution, 1646 ) -> list[str]: 1647 """ 1648 Build command line arguments. This method is called by the main command. 1649 1650 Args: 1651 execution: The execution object. 1652 Returns: 1653 Command line arguments 1654 """ 1655 cargs = [] 1656 cargs.extend([ 1657 "-endfor", 1658 self.endfor 1659 ]) 1660 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1707@dataclasses.dataclass 1708class C3dErf: 1709 """ 1710 -erf: Standard error function 1711 1712 Syntax: `-erf mu sigma` 1713 1714 Computes the standard error function. This is useful for applying soft 1715 thresholds. The function computes y = erf((x - mu)/sigma). 1716 1717 c3d input.img -erf 5 2 -o erf.img. 1718 """ 1719 erf: str 1720 """-erf: Standard error function 1721 1722 Syntax: `-erf mu sigma` 1723 1724 Computes the standard error function. This is useful for applying soft 1725 thresholds. The function computes y = erf((x - mu)/sigma). 1726 1727 c3d input.img -erf 5 2 -o erf.img""" 1728 1729 def run( 1730 self, 1731 execution: Execution, 1732 ) -> list[str]: 1733 """ 1734 Build command line arguments. This method is called by the main command. 1735 1736 Args: 1737 execution: The execution object. 1738 Returns: 1739 Command line arguments 1740 """ 1741 cargs = [] 1742 cargs.extend([ 1743 "-erf", 1744 self.erf 1745 ]) 1746 return cargs
-erf: Standard error function
Syntax: -erf mu sigma
Computes the standard error function. This is useful for applying soft thresholds. The function computes y = erf((x - mu)/sigma).
c3d input.img -erf 5 2 -o erf.img.
-erf: Standard error function
Syntax: -erf mu sigma
Computes the standard error function. This is useful for applying soft thresholds. The function computes y = erf((x - mu)/sigma).
c3d input.img -erf 5 2 -o erf.img
1729 def run( 1730 self, 1731 execution: Execution, 1732 ) -> list[str]: 1733 """ 1734 Build command line arguments. This method is called by the main command. 1735 1736 Args: 1737 execution: The execution object. 1738 Returns: 1739 Command line arguments 1740 """ 1741 cargs = [] 1742 cargs.extend([ 1743 "-erf", 1744 self.erf 1745 ]) 1746 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1663@dataclasses.dataclass 1664class C3dErode: 1665 """ 1666 -erode: Binary erosion 1667 1668 Syntax: `-erode <label> <radius_vector>` 1669 1670 Applies erosion [mathematical morphology][5] operation to a binary image. 1671 The first parameter is the intensity value of the object that is to be 1672 eroded. The second is the radius of the erosion structuring element in 3D. 1673 1674 c3d binary.img -erode 255 3x3x3vox -o newimage.img. 1675 """ 1676 erode: str 1677 """-erode: Binary erosion 1678 1679 Syntax: `-erode <label> <radius_vector>` 1680 1681 Applies erosion [mathematical morphology][5] operation to a binary image. 1682 The first parameter is the intensity value of the object that is to be 1683 eroded. The second is the radius of the erosion structuring element in 3D. 1684 1685 c3d binary.img -erode 255 3x3x3vox -o newimage.img""" 1686 1687 def run( 1688 self, 1689 execution: Execution, 1690 ) -> list[str]: 1691 """ 1692 Build command line arguments. This method is called by the main command. 1693 1694 Args: 1695 execution: The execution object. 1696 Returns: 1697 Command line arguments 1698 """ 1699 cargs = [] 1700 cargs.extend([ 1701 "-erode", 1702 self.erode 1703 ]) 1704 return cargs
-erode: Binary erosion
Syntax: -erode <label> <radius_vector>
Applies erosion [mathematical morphology][5] operation to a binary image. The first parameter is the intensity value of the object that is to be eroded. The second is the radius of the erosion structuring element in 3D.
c3d binary.img -erode 255 3x3x3vox -o newimage.img.
-erode: Binary erosion
Syntax: -erode <label> <radius_vector>
Applies erosion [mathematical morphology][5] operation to a binary image. The first parameter is the intensity value of the object that is to be eroded. The second is the radius of the erosion structuring element in 3D.
c3d binary.img -erode 255 3x3x3vox -o newimage.img
1687 def run( 1688 self, 1689 execution: Execution, 1690 ) -> list[str]: 1691 """ 1692 Build command line arguments. This method is called by the main command. 1693 1694 Args: 1695 execution: The execution object. 1696 Returns: 1697 Command line arguments 1698 """ 1699 cargs = [] 1700 cargs.extend([ 1701 "-erode", 1702 self.erode 1703 ]) 1704 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1749@dataclasses.dataclass 1750class C3dExp: 1751 """ 1752 -exp: Voxelwise natural exponent 1753 1754 Syntax: `-exp` 1755 1756 Computes exponent of each voxel in the last image on the stack. 1757 1758 c3d input.img -exp -o output.img. 1759 """ 1760 exp: str 1761 """-exp: Voxelwise natural exponent 1762 1763 Syntax: `-exp` 1764 1765 Computes exponent of each voxel in the last image on the stack. 1766 1767 c3d input.img -exp -o output.img""" 1768 1769 def run( 1770 self, 1771 execution: Execution, 1772 ) -> list[str]: 1773 """ 1774 Build command line arguments. This method is called by the main command. 1775 1776 Args: 1777 execution: The execution object. 1778 Returns: 1779 Command line arguments 1780 """ 1781 cargs = [] 1782 cargs.extend([ 1783 "-exp", 1784 self.exp 1785 ]) 1786 return cargs
-exp: Voxelwise natural exponent
Syntax: -exp
Computes exponent of each voxel in the last image on the stack.
c3d input.img -exp -o output.img.
-exp: Voxelwise natural exponent
Syntax: -exp
Computes exponent of each voxel in the last image on the stack.
c3d input.img -exp -o output.img
1769 def run( 1770 self, 1771 execution: Execution, 1772 ) -> list[str]: 1773 """ 1774 Build command line arguments. This method is called by the main command. 1775 1776 Args: 1777 execution: The execution object. 1778 Returns: 1779 Command line arguments 1780 """ 1781 cargs = [] 1782 cargs.extend([ 1783 "-exp", 1784 self.exp 1785 ]) 1786 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1789@dataclasses.dataclass 1790class C3dExportPatches: 1791 """ 1792 -export-patches, -xp: Fixed size patch sampling from masked regions 1793 1794 Syntax: `-export-patches <outfile> <radius_vector> <frequency>` 1795 1796 See also: **-export-patches-aug (-xpa)** command, which provides data 1797 augmentation for deep learning. 1798 1799 This command samples patches from a region of a ND image and stores them 1800 into a data file that can be read easily in other software, for example, 1801 NumPy. This is useful for generating training data for machine learning 1802 projects. Multiple "channels" can be sampled. 1803 1804 c3d chan1.nii chan2.nii chan3.nii mask.nii -xp samples.dat 4x4x4 100 1805 1806 This command will sample the three images chan1, chan2, chan3 at foreground 1807 voxels in the mask. Voxels in the mask foreground region are sampled 1808 randomly, following a uniform distribution. The value of 100 means that 1809 every 100-th voxel, on average, is sampled. The radius 4x4x4 means that 1810 patches of size 9x9x9 will be generated. For each sampled voxel, the sampled 1811 intensity data is represented as a 3x9x9x9 array in this example. 1812 1813 To read these samples in NumPy use the following code 1814 1815 dims = (9,9,9) # Patch dimensions 1816 k = 3 # Number of channels 1817 bps = (4 * k * reduce(mul, dims, 1)) # Bytes per sample 1818 np = os.path.getsize(fname) // bps # Number of samples 1819 arr = numpy.memmap(fname,'float32','r',shape=(np,k) + dims) 1820 1821 It is also possible to visualize the extracted samples in ITK-SNAP by 1822 reading them as a raw image, with dimensions equal to the dimensions of the 1823 patch, and the z-dimension multiplied by the number of samples. 1824 1825 The command can also be used to extract entire structures. For example, if 1826 we have a binary segmentation of a lesion of an approximately known size in 1827 an MRI scan, we can extract a patch of given size centered on this lesion, 1828 as follows: 1829 1830 c3d mri.nii lesion_seg.nii -centroid-mark 1 -xp single_sample.dat 50x50x20 1 1831 1832 In the above example, **-centroid-mark** transforms the lesion segmentation 1833 into a single-voxel mask, from which the sample from the MRI is taken. 1834 """ 1835 export_patches: str 1836 """-export-patches, -xp: Fixed size patch sampling from masked regions 1837 1838 Syntax: `-export-patches <outfile> <radius_vector> <frequency>` 1839 1840 See also: **-export-patches-aug (-xpa)** command, which provides data 1841 augmentation for deep learning. 1842 1843 This command samples patches from a region of a ND image and stores them 1844 into a data file that can be read easily in other software, for example, 1845 NumPy. This is useful for generating training data for machine learning 1846 projects. Multiple "channels" can be sampled. 1847 1848 c3d chan1.nii chan2.nii chan3.nii mask.nii -xp samples.dat 4x4x4 100 1849 1850 This command will sample the three images chan1, chan2, chan3 at foreground 1851 voxels in the mask. Voxels in the mask foreground region are sampled 1852 randomly, following a uniform distribution. The value of 100 means that 1853 every 100-th voxel, on average, is sampled. The radius 4x4x4 means that 1854 patches of size 9x9x9 will be generated. For each sampled voxel, the sampled 1855 intensity data is represented as a 3x9x9x9 array in this example. 1856 1857 To read these samples in NumPy use the following code 1858 1859 dims = (9,9,9) # Patch dimensions 1860 k = 3 # Number of channels 1861 bps = (4 * k * reduce(mul, dims, 1)) # Bytes per sample 1862 np = os.path.getsize(fname) // bps # Number of samples 1863 arr = numpy.memmap(fname,'float32','r',shape=(np,k) + dims) 1864 1865 It is also possible to visualize the extracted samples in ITK-SNAP by 1866 reading them as a raw image, with dimensions equal to the dimensions of the 1867 patch, and the z-dimension multiplied by the number of samples. 1868 1869 The command can also be used to extract entire structures. For example, if 1870 we have a binary segmentation of a lesion of an approximately known size in 1871 an MRI scan, we can extract a patch of given size centered on this lesion, 1872 as follows: 1873 1874 c3d mri.nii lesion_seg.nii -centroid-mark 1 -xp single_sample.dat 50x50x20 1 1875 1876 In the above example, **-centroid-mark** transforms the lesion segmentation 1877 into a single-voxel mask, from which the sample from the MRI is taken.""" 1878 1879 def run( 1880 self, 1881 execution: Execution, 1882 ) -> list[str]: 1883 """ 1884 Build command line arguments. This method is called by the main command. 1885 1886 Args: 1887 execution: The execution object. 1888 Returns: 1889 Command line arguments 1890 """ 1891 cargs = [] 1892 cargs.extend([ 1893 "-export-patches", 1894 self.export_patches 1895 ]) 1896 return cargs
-export-patches, -xp: Fixed size patch sampling from masked regions
Syntax: -export-patches <outfile> <radius_vector> <frequency>
See also: -export-patches-aug (-xpa) command, which provides data augmentation for deep learning.
This command samples patches from a region of a ND image and stores them into a data file that can be read easily in other software, for example, NumPy. This is useful for generating training data for machine learning projects. Multiple "channels" can be sampled.
c3d chan1.nii chan2.nii chan3.nii mask.nii -xp samples.dat 4x4x4 100
This command will sample the three images chan1, chan2, chan3 at foreground voxels in the mask. Voxels in the mask foreground region are sampled randomly, following a uniform distribution. The value of 100 means that every 100-th voxel, on average, is sampled. The radius 4x4x4 means that patches of size 9x9x9 will be generated. For each sampled voxel, the sampled intensity data is represented as a 3x9x9x9 array in this example.
To read these samples in NumPy use the following code
dims = (9,9,9) # Patch dimensions k = 3 # Number of channels bps = (4 * k * reduce(mul, dims, 1)) # Bytes per sample np = os.path.getsize(fname) // bps # Number of samples arr = numpy.memmap(fname,'float32','r',shape=(np,k) + dims)
It is also possible to visualize the extracted samples in ITK-SNAP by reading them as a raw image, with dimensions equal to the dimensions of the patch, and the z-dimension multiplied by the number of samples.
The command can also be used to extract entire structures. For example, if we have a binary segmentation of a lesion of an approximately known size in an MRI scan, we can extract a patch of given size centered on this lesion, as follows:
c3d mri.nii lesion_seg.nii -centroid-mark 1 -xp single_sample.dat 50x50x20 1
In the above example, -centroid-mark transforms the lesion segmentation into a single-voxel mask, from which the sample from the MRI is taken.
-export-patches, -xp: Fixed size patch sampling from masked regions
Syntax: -export-patches <outfile> <radius_vector> <frequency>
See also: -export-patches-aug (-xpa) command, which provides data augmentation for deep learning.
This command samples patches from a region of a ND image and stores them into a data file that can be read easily in other software, for example, NumPy. This is useful for generating training data for machine learning projects. Multiple "channels" can be sampled.
c3d chan1.nii chan2.nii chan3.nii mask.nii -xp samples.dat 4x4x4 100
This command will sample the three images chan1, chan2, chan3 at foreground voxels in the mask. Voxels in the mask foreground region are sampled randomly, following a uniform distribution. The value of 100 means that every 100-th voxel, on average, is sampled. The radius 4x4x4 means that patches of size 9x9x9 will be generated. For each sampled voxel, the sampled intensity data is represented as a 3x9x9x9 array in this example.
To read these samples in NumPy use the following code
dims = (9,9,9) # Patch dimensions k = 3 # Number of channels bps = (4 * k * reduce(mul, dims, 1)) # Bytes per sample np = os.path.getsize(fname) // bps # Number of samples arr = numpy.memmap(fname,'float32','r',shape=(np,k) + dims)
It is also possible to visualize the extracted samples in ITK-SNAP by reading them as a raw image, with dimensions equal to the dimensions of the patch, and the z-dimension multiplied by the number of samples.
The command can also be used to extract entire structures. For example, if we have a binary segmentation of a lesion of an approximately known size in an MRI scan, we can extract a patch of given size centered on this lesion, as follows:
c3d mri.nii lesion_seg.nii -centroid-mark 1 -xp single_sample.dat 50x50x20 1
In the above example, -centroid-mark transforms the lesion segmentation into a single-voxel mask, from which the sample from the MRI is taken.
1879 def run( 1880 self, 1881 execution: Execution, 1882 ) -> list[str]: 1883 """ 1884 Build command line arguments. This method is called by the main command. 1885 1886 Args: 1887 execution: The execution object. 1888 Returns: 1889 Command line arguments 1890 """ 1891 cargs = [] 1892 cargs.extend([ 1893 "-export-patches", 1894 self.export_patches 1895 ]) 1896 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1899@dataclasses.dataclass 1900class C3dExportPatchesAug: 1901 """ 1902 -export-patches-aug, -xpa: data augmentation for deep learning 1903 1904 Syntax `-export-patches-aug <N> <sigma_angle>` 1905 1906 This command must precede the `-export-patches (-xp)` command and instructs 1907 this command to not only sample patches along the image axes but to also 1908 sample **N** randomly rotated patches. Rotation is around a uniformly 1909 distributed axis with a rotation angle distributed normally with teh 1910 standard deviation **sigma_angle**, specified in degrees. This kind of 1911 sampling is useful for data augmentation for machine learning algorithms. 1912 1913 c3d chan1.nii chan2.nii chan3.nii mask.nii -xpa 5 10 -xp samples.dat 4x4x4 1914 100. 1915 """ 1916 export_patches_aug: str 1917 """-export-patches-aug, -xpa: data augmentation for deep learning 1918 1919 Syntax `-export-patches-aug <N> <sigma_angle>` 1920 1921 This command must precede the `-export-patches (-xp)` command and instructs 1922 this command to not only sample patches along the image axes but to also 1923 sample **N** randomly rotated patches. Rotation is around a uniformly 1924 distributed axis with a rotation angle distributed normally with teh 1925 standard deviation **sigma_angle**, specified in degrees. This kind of 1926 sampling is useful for data augmentation for machine learning algorithms. 1927 1928 c3d chan1.nii chan2.nii chan3.nii mask.nii -xpa 5 10 -xp samples.dat 4x4x4 1929 100""" 1930 1931 def run( 1932 self, 1933 execution: Execution, 1934 ) -> list[str]: 1935 """ 1936 Build command line arguments. This method is called by the main command. 1937 1938 Args: 1939 execution: The execution object. 1940 Returns: 1941 Command line arguments 1942 """ 1943 cargs = [] 1944 cargs.extend([ 1945 "-export-patches-aug", 1946 self.export_patches_aug 1947 ]) 1948 return cargs
-export-patches-aug, -xpa: data augmentation for deep learning
Syntax -export-patches-aug <N> <sigma_angle>
This command must precede the -export-patches (-xp) command and instructs
this command to not only sample patches along the image axes but to also
sample N randomly rotated patches. Rotation is around a uniformly
distributed axis with a rotation angle distributed normally with teh
standard deviation sigma_angle, specified in degrees. This kind of
sampling is useful for data augmentation for machine learning algorithms.
c3d chan1.nii chan2.nii chan3.nii mask.nii -xpa 5 10 -xp samples.dat 4x4x4 100.
-export-patches-aug, -xpa: data augmentation for deep learning
Syntax -export-patches-aug <N> <sigma_angle>
This command must precede the -export-patches (-xp) command and instructs
this command to not only sample patches along the image axes but to also
sample N randomly rotated patches. Rotation is around a uniformly
distributed axis with a rotation angle distributed normally with teh
standard deviation sigma_angle, specified in degrees. This kind of
sampling is useful for data augmentation for machine learning algorithms.
c3d chan1.nii chan2.nii chan3.nii mask.nii -xpa 5 10 -xp samples.dat 4x4x4 100
1931 def run( 1932 self, 1933 execution: Execution, 1934 ) -> list[str]: 1935 """ 1936 Build command line arguments. This method is called by the main command. 1937 1938 Args: 1939 execution: The execution object. 1940 Returns: 1941 Command line arguments 1942 """ 1943 cargs = [] 1944 cargs.extend([ 1945 "-export-patches-aug", 1946 self.export_patches_aug 1947 ]) 1948 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1951@dataclasses.dataclass 1952class C3dExtrudeSeg: 1953 """ 1954 No description found. 1955 """ 1956 extrude_seg: str 1957 """No description found.""" 1958 1959 def run( 1960 self, 1961 execution: Execution, 1962 ) -> list[str]: 1963 """ 1964 Build command line arguments. This method is called by the main command. 1965 1966 Args: 1967 execution: The execution object. 1968 Returns: 1969 Command line arguments 1970 """ 1971 cargs = [] 1972 cargs.extend([ 1973 "-extrude-seg", 1974 self.extrude_seg 1975 ]) 1976 return cargs
No description found.
1959 def run( 1960 self, 1961 execution: Execution, 1962 ) -> list[str]: 1963 """ 1964 Build command line arguments. This method is called by the main command. 1965 1966 Args: 1967 execution: The execution object. 1968 Returns: 1969 Command line arguments 1970 """ 1971 cargs = [] 1972 cargs.extend([ 1973 "-extrude-seg", 1974 self.extrude_seg 1975 ]) 1976 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2007@dataclasses.dataclass 2008class C3dFft: 2009 """ 2010 -fft: Fast Fourier transform 2011 2012 Syntax `-fft` 2013 2014 Computes the Fourier transform of a real-valued image at the end of the 2015 stack. The image is replaced by the real and imaginary components of the 2016 FFT. This command is only available if **convert3d** is compiled with the 2017 FFTW library support. 2018 2019 c3d image.nii -fft -oo real.nii imag.nii. 2020 """ 2021 fft: str 2022 """-fft: Fast Fourier transform 2023 2024 Syntax `-fft` 2025 2026 Computes the Fourier transform of a real-valued image at the end of the 2027 stack. The image is replaced by the real and imaginary components of the 2028 FFT. This command is only available if **convert3d** is compiled with the 2029 FFTW library support. 2030 2031 c3d image.nii -fft -oo real.nii imag.nii""" 2032 2033 def run( 2034 self, 2035 execution: Execution, 2036 ) -> list[str]: 2037 """ 2038 Build command line arguments. This method is called by the main command. 2039 2040 Args: 2041 execution: The execution object. 2042 Returns: 2043 Command line arguments 2044 """ 2045 cargs = [] 2046 cargs.extend([ 2047 "-fft", 2048 self.fft 2049 ]) 2050 return cargs
-fft: Fast Fourier transform
Syntax -fft
Computes the Fourier transform of a real-valued image at the end of the stack. The image is replaced by the real and imaginary components of the FFT. This command is only available if convert3d is compiled with the FFTW library support.
c3d image.nii -fft -oo real.nii imag.nii.
-fft: Fast Fourier transform
Syntax -fft
Computes the Fourier transform of a real-valued image at the end of the stack. The image is replaced by the real and imaginary components of the FFT. This command is only available if convert3d is compiled with the FFTW library support.
c3d image.nii -fft -oo real.nii imag.nii
2033 def run( 2034 self, 2035 execution: Execution, 2036 ) -> list[str]: 2037 """ 2038 Build command line arguments. This method is called by the main command. 2039 2040 Args: 2041 execution: The execution object. 2042 Returns: 2043 Command line arguments 2044 """ 2045 cargs = [] 2046 cargs.extend([ 2047 "-fft", 2048 self.fft 2049 ]) 2050 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1979@dataclasses.dataclass 1980class C3dFillBackgroundWithNoise: 1981 """ 1982 No description found. 1983 """ 1984 fill_background_with_noise: str 1985 """No description found.""" 1986 1987 def run( 1988 self, 1989 execution: Execution, 1990 ) -> list[str]: 1991 """ 1992 Build command line arguments. This method is called by the main command. 1993 1994 Args: 1995 execution: The execution object. 1996 Returns: 1997 Command line arguments 1998 """ 1999 cargs = [] 2000 cargs.extend([ 2001 "-fill-background-with-noise", 2002 self.fill_background_with_noise 2003 ]) 2004 return cargs
No description found.
1987 def run( 1988 self, 1989 execution: Execution, 1990 ) -> list[str]: 1991 """ 1992 Build command line arguments. This method is called by the main command. 1993 1994 Args: 1995 execution: The execution object. 1996 Returns: 1997 Command line arguments 1998 """ 1999 cargs = [] 2000 cargs.extend([ 2001 "-fill-background-with-noise", 2002 self.fill_background_with_noise 2003 ]) 2004 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2053@dataclasses.dataclass 2054class C3dFlip: 2055 """ 2056 -flip: Flip image around an axis 2057 2058 Syntax: `-flip axes` 2059 2060 Flips the image around specified axes. The parameter 'axes' may be any 2061 combination of characters 'x', 'y', and 'z'; the order does not matter. 2062 2063 c3d input.img -flip xy -o output.img. 2064 """ 2065 flip: str 2066 """-flip: Flip image around an axis 2067 2068 Syntax: `-flip axes` 2069 2070 Flips the image around specified axes. The parameter 'axes' may be any 2071 combination of characters 'x', 'y', and 'z'; the order does not matter. 2072 2073 c3d input.img -flip xy -o output.img""" 2074 2075 def run( 2076 self, 2077 execution: Execution, 2078 ) -> list[str]: 2079 """ 2080 Build command line arguments. This method is called by the main command. 2081 2082 Args: 2083 execution: The execution object. 2084 Returns: 2085 Command line arguments 2086 """ 2087 cargs = [] 2088 cargs.extend([ 2089 "-flip", 2090 self.flip 2091 ]) 2092 return cargs
-flip: Flip image around an axis
Syntax: -flip axes
Flips the image around specified axes. The parameter 'axes' may be any combination of characters 'x', 'y', and 'z'; the order does not matter.
c3d input.img -flip xy -o output.img.
-flip: Flip image around an axis
Syntax: -flip axes
Flips the image around specified axes. The parameter 'axes' may be any combination of characters 'x', 'y', and 'z'; the order does not matter.
c3d input.img -flip xy -o output.img
2075 def run( 2076 self, 2077 execution: Execution, 2078 ) -> list[str]: 2079 """ 2080 Build command line arguments. This method is called by the main command. 2081 2082 Args: 2083 execution: The execution object. 2084 Returns: 2085 Command line arguments 2086 """ 2087 cargs = [] 2088 cargs.extend([ 2089 "-flip", 2090 self.flip 2091 ]) 2092 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2095@dataclasses.dataclass 2096class C3dFloor: 2097 """ 2098 -floor: Round down image intensities 2099 2100 Syntax: `-floor ` 2101 2102 Each image intensity is replaced by the largest integer smaller or equal to 2103 it. 2104 2105 c3d input.img -floor -o output.img 2106 2107 To round each intensity to the closest integer, use 2108 2109 c3d input.img -shift 0.5 -floor. 2110 """ 2111 floor: str 2112 """-floor: Round down image intensities 2113 2114 Syntax: `-floor ` 2115 2116 Each image intensity is replaced by the largest integer smaller or equal to 2117 it. 2118 2119 c3d input.img -floor -o output.img 2120 2121 To round each intensity to the closest integer, use 2122 2123 c3d input.img -shift 0.5 -floor""" 2124 2125 def run( 2126 self, 2127 execution: Execution, 2128 ) -> list[str]: 2129 """ 2130 Build command line arguments. This method is called by the main command. 2131 2132 Args: 2133 execution: The execution object. 2134 Returns: 2135 Command line arguments 2136 """ 2137 cargs = [] 2138 cargs.extend([ 2139 "-floor", 2140 self.floor 2141 ]) 2142 return cargs
-floor: Round down image intensities
Syntax: -floor
Each image intensity is replaced by the largest integer smaller or equal to it.
c3d input.img -floor -o output.img
To round each intensity to the closest integer, use
c3d input.img -shift 0.5 -floor.
-floor: Round down image intensities
Syntax: -floor
Each image intensity is replaced by the largest integer smaller or equal to it.
c3d input.img -floor -o output.img
To round each intensity to the closest integer, use
c3d input.img -shift 0.5 -floor
2125 def run( 2126 self, 2127 execution: Execution, 2128 ) -> list[str]: 2129 """ 2130 Build command line arguments. This method is called by the main command. 2131 2132 Args: 2133 execution: The execution object. 2134 Returns: 2135 Command line arguments 2136 """ 2137 cargs = [] 2138 cargs.extend([ 2139 "-floor", 2140 self.floor 2141 ]) 2142 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2145@dataclasses.dataclass 2146class C3dForeach: 2147 """ 2148 -foreach, -endfor: Loop commands over all images on the stack 2149 2150 Syntax: `-foreach commands-list -endfor` 2151 2152 This command forces the commands between **-foreach** and **-endfor** to be 2153 applied to every image on the stack. The main use of this command is to 2154 automate processing of multiple datasets. For example, 2155 2156 c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii. 2157 """ 2158 foreach: str 2159 """-foreach, -endfor: Loop commands over all images on the stack 2160 2161 Syntax: `-foreach commands-list -endfor` 2162 2163 This command forces the commands between **-foreach** and **-endfor** to be 2164 applied to every image on the stack. The main use of this command is to 2165 automate processing of multiple datasets. For example, 2166 2167 c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii""" 2168 2169 def run( 2170 self, 2171 execution: Execution, 2172 ) -> list[str]: 2173 """ 2174 Build command line arguments. This method is called by the main command. 2175 2176 Args: 2177 execution: The execution object. 2178 Returns: 2179 Command line arguments 2180 """ 2181 cargs = [] 2182 cargs.extend([ 2183 "-foreach", 2184 self.foreach 2185 ]) 2186 return cargs
-foreach, -endfor: Loop commands over all images on the stack
Syntax: -foreach commands-list -endfor
This command forces the commands between -foreach and -endfor to be applied to every image on the stack. The main use of this command is to automate processing of multiple datasets. For example,
c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii.
-foreach, -endfor: Loop commands over all images on the stack
Syntax: -foreach commands-list -endfor
This command forces the commands between -foreach and -endfor to be applied to every image on the stack. The main use of this command is to automate processing of multiple datasets. For example,
c3d epi*.nii -foreach -smooth 3mm -endfor -oo epism%03d.nii
2169 def run( 2170 self, 2171 execution: Execution, 2172 ) -> list[str]: 2173 """ 2174 Build command line arguments. This method is called by the main command. 2175 2176 Args: 2177 execution: The execution object. 2178 Returns: 2179 Command line arguments 2180 """ 2181 cargs = [] 2182 cargs.extend([ 2183 "-foreach", 2184 self.foreach 2185 ]) 2186 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2189@dataclasses.dataclass 2190class C3dForeachComp: 2191 """ 2192 -foreach-comp, -endfor: Loop commands over components of a multi-component 2193 image 2194 2195 Syntax `-foreach-comp <N> commands-list -endfor` 2196 2197 This command runs the list of commands separately for each component of a 2198 set of multi-component images loaded with -mcs. This makes it possible to 2199 perform component-wise operations on multi-component images. For example, it 2200 can be used to average several multi-component images. If the image stack 2201 contains images *x1* *y1* *z1* *x2* *y2* *z2*, then the operations will be 2202 run on *[x1,x2]*, *[y1,y2]*, *[z1,z2]*. For example, if multi_1.nii to 2203 multi_10.nii are three-component images, then the mean three-component image 2204 is given by 2205 2206 c2d -mcs multi_*.nii -foreach-comp -mean -endfor -omc multi_mean.nii. 2207 """ 2208 foreach_comp: str 2209 """-foreach-comp, -endfor: Loop commands over components of a 2210 multi-component image 2211 2212 Syntax `-foreach-comp <N> commands-list -endfor` 2213 2214 This command runs the list of commands separately for each component of a 2215 set of multi-component images loaded with -mcs. This makes it possible to 2216 perform component-wise operations on multi-component images. For example, it 2217 can be used to average several multi-component images. If the image stack 2218 contains images *x1* *y1* *z1* *x2* *y2* *z2*, then the operations will be 2219 run on *[x1,x2]*, *[y1,y2]*, *[z1,z2]*. For example, if multi_1.nii to 2220 multi_10.nii are three-component images, then the mean three-component image 2221 is given by 2222 2223 c2d -mcs multi_*.nii -foreach-comp -mean -endfor -omc multi_mean.nii""" 2224 2225 def run( 2226 self, 2227 execution: Execution, 2228 ) -> list[str]: 2229 """ 2230 Build command line arguments. This method is called by the main command. 2231 2232 Args: 2233 execution: The execution object. 2234 Returns: 2235 Command line arguments 2236 """ 2237 cargs = [] 2238 cargs.extend([ 2239 "-foreach-comp", 2240 self.foreach_comp 2241 ]) 2242 return cargs
-foreach-comp, -endfor: Loop commands over components of a multi-component image
Syntax -foreach-comp <N> commands-list -endfor
This command runs the list of commands separately for each component of a set of multi-component images loaded with -mcs. This makes it possible to perform component-wise operations on multi-component images. For example, it can be used to average several multi-component images. If the image stack contains images x1 y1 z1 x2 y2 z2, then the operations will be run on [x1,x2], [y1,y2], [z1,z2]. For example, if multi_1.nii to multi_10.nii are three-component images, then the mean three-component image is given by
c2d -mcs multi_*.nii -foreach-comp -mean -endfor -omc multi_mean.nii.
-foreach-comp, -endfor: Loop commands over components of a multi-component image
Syntax -foreach-comp <N> commands-list -endfor
This command runs the list of commands separately for each component of a set of multi-component images loaded with -mcs. This makes it possible to perform component-wise operations on multi-component images. For example, it can be used to average several multi-component images. If the image stack contains images x1 y1 z1 x2 y2 z2, then the operations will be run on [x1,x2], [y1,y2], [z1,z2]. For example, if multi_1.nii to multi_10.nii are three-component images, then the mean three-component image is given by
c2d -mcs multi_*.nii -foreach-comp -mean -endfor -omc multi_mean.nii
2225 def run( 2226 self, 2227 execution: Execution, 2228 ) -> list[str]: 2229 """ 2230 Build command line arguments. This method is called by the main command. 2231 2232 Args: 2233 execution: The execution object. 2234 Returns: 2235 Command line arguments 2236 """ 2237 cargs = [] 2238 cargs.extend([ 2239 "-foreach-comp", 2240 self.foreach_comp 2241 ]) 2242 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2245@dataclasses.dataclass 2246class C3dGlm: 2247 """ 2248 -glm: General linear model 2249 2250 Syntax: `-glm design_matrix_file contrast_vector_file` 2251 2252 Applies voxel-wise general linear model to a set of images. More precisely, 2253 the general linear model solves the following system: $Y = X \beta + 2254 \epsilon$, where Y are the observations (a list of n images, where each 2255 voxel is treated as an independent observation); X is the $n x k$ design 2256 matrix, where $k$ is the number of factors; $\beta$ is a set of $k$ unknown 2257 images (factors) and $\epsilon$ is the error term. The command will compute 2258 the $\beta$ images and return a weighted sum of them, where the weights are 2259 specified in the contrast vector. The design matrix and the contrast vector 2260 are passed in as files. The file format is just a space-separated list of 2261 numbers. For a good explanation of the general linear model, see [S. Kiebel 2262 and A. Holmes, General Linear Model, in Ashburner, Friston, Holmes eds., 2263 *Human Brain Function, 2nd Edition*][6]. The example below computes the 2264 regression coefficient between a set of longitudinal images and subject's 2265 age: 2266 2267 echo "1 67.00" > design_mat.txt 2268 echo "1 75.00" >> design_mat.txt 2269 echo "1 80.00" >> design_mat.txt 2270 echo "1 83.00" >> design_mat.txt 2271 echo "0 1" >> contrast_vec.txt 2272 c3d time1.img time2.img time3.img time4.img -glm design_mat.txt 2273 contrast_vec.txt -o regress.img. 2274 """ 2275 glm: str 2276 """-glm: General linear model 2277 2278 Syntax: `-glm design_matrix_file contrast_vector_file` 2279 2280 Applies voxel-wise general linear model to a set of images. More precisely, 2281 the general linear model solves the following system: $Y = X \beta + 2282 \epsilon$, where Y are the observations (a list of n images, where each 2283 voxel is treated as an independent observation); X is the $n x k$ design 2284 matrix, where $k$ is the number of factors; $\beta$ is a set of $k$ unknown 2285 images (factors) and $\epsilon$ is the error term. The command will compute 2286 the $\beta$ images and return a weighted sum of them, where the weights are 2287 specified in the contrast vector. The design matrix and the contrast vector 2288 are passed in as files. The file format is just a space-separated list of 2289 numbers. For a good explanation of the general linear model, see [S. Kiebel 2290 and A. Holmes, General Linear Model, in Ashburner, Friston, Holmes eds., 2291 *Human Brain Function, 2nd Edition*][6]. The example below computes the 2292 regression coefficient between a set of longitudinal images and subject's 2293 age: 2294 2295 echo "1 67.00" > design_mat.txt 2296 echo "1 75.00" >> design_mat.txt 2297 echo "1 80.00" >> design_mat.txt 2298 echo "1 83.00" >> design_mat.txt 2299 echo "0 1" >> contrast_vec.txt 2300 c3d time1.img time2.img time3.img time4.img -glm design_mat.txt 2301 contrast_vec.txt -o regress.img""" 2302 2303 def run( 2304 self, 2305 execution: Execution, 2306 ) -> list[str]: 2307 """ 2308 Build command line arguments. This method is called by the main command. 2309 2310 Args: 2311 execution: The execution object. 2312 Returns: 2313 Command line arguments 2314 """ 2315 cargs = [] 2316 cargs.extend([ 2317 "-glm", 2318 self.glm 2319 ]) 2320 return cargs
-glm: General linear model
Syntax: -glm design_matrix_file contrast_vector_file
Applies voxel-wise general linear model to a set of images. More precisely, the general linear model solves the following system: $Y = X eta + \epsilon$, where Y are the observations (a list of n images, where each voxel is treated as an independent observation); X is the $n x k$ design matrix, where $k$ is the number of factors; $eta$ is a set of $k$ unknown images (factors) and $\epsilon$ is the error term. The command will compute the $eta$ images and return a weighted sum of them, where the weights are specified in the contrast vector. The design matrix and the contrast vector are passed in as files. The file format is just a space-separated list of numbers. For a good explanation of the general linear model, see [S. Kiebel and A. Holmes, General Linear Model, in Ashburner, Friston, Holmes eds., Human Brain Function, 2nd Edition][6]. The example below computes the regression coefficient between a set of longitudinal images and subject's age:
echo "1 67.00" > design_mat.txt echo "1 75.00" >> design_mat.txt echo "1 80.00" >> design_mat.txt echo "1 83.00" >> design_mat.txt echo "0 1" >> contrast_vec.txt c3d time1.img time2.img time3.img time4.img -glm design_mat.txt contrast_vec.txt -o regress.img.
-glm: General linear model
Syntax: -glm design_matrix_file contrast_vector_file
Applies voxel-wise general linear model to a set of images. More precisely, the general linear model solves the following system: $Y = X eta + \epsilon$, where Y are the observations (a list of n images, where each voxel is treated as an independent observation); X is the $n x k$ design matrix, where $k$ is the number of factors; $eta$ is a set of $k$ unknown images (factors) and $\epsilon$ is the error term. The command will compute the $eta$ images and return a weighted sum of them, where the weights are specified in the contrast vector. The design matrix and the contrast vector are passed in as files. The file format is just a space-separated list of numbers. For a good explanation of the general linear model, see [S. Kiebel and A. Holmes, General Linear Model, in Ashburner, Friston, Holmes eds., Human Brain Function, 2nd Edition][6]. The example below computes the regression coefficient between a set of longitudinal images and subject's age:
echo "1 67.00" > design_mat.txt echo "1 75.00" >> design_mat.txt echo "1 80.00" >> design_mat.txt echo "1 83.00" >> design_mat.txt echo "0 1" >> contrast_vec.txt c3d time1.img time2.img time3.img time4.img -glm design_mat.txt contrast_vec.txt -o regress.img
2303 def run( 2304 self, 2305 execution: Execution, 2306 ) -> list[str]: 2307 """ 2308 Build command line arguments. This method is called by the main command. 2309 2310 Args: 2311 execution: The execution object. 2312 Returns: 2313 Command line arguments 2314 """ 2315 cargs = [] 2316 cargs.extend([ 2317 "-glm", 2318 self.glm 2319 ]) 2320 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2323@dataclasses.dataclass 2324class C3dGradient: 2325 """ 2326 -grad, -gradient: Image gradient 2327 2328 Syntax `-grad` 2329 2330 Computes the gradient of the image. Each component of the gradient is placed 2331 on the stack in order (x,y,z). The gradient is computed in physical RAS 2332 coordinates, taking into account image spacing and orientation. In other 2333 words, the gradient is the vector in physical space orthogonal to the 2334 isocontours of the image. No smoothing is performed, so it is a good idea to 2335 smooth the image first before computing the gradient. 2336 2337 c3d myimage.nii -smooth 1.2vox -grad -oo grad_comp_%02d.nii. 2338 """ 2339 gradient: str 2340 """-grad, -gradient: Image gradient 2341 2342 Syntax `-grad` 2343 2344 Computes the gradient of the image. Each component of the gradient is placed 2345 on the stack in order (x,y,z). The gradient is computed in physical RAS 2346 coordinates, taking into account image spacing and orientation. In other 2347 words, the gradient is the vector in physical space orthogonal to the 2348 isocontours of the image. No smoothing is performed, so it is a good idea to 2349 smooth the image first before computing the gradient. 2350 2351 c3d myimage.nii -smooth 1.2vox -grad -oo grad_comp_%02d.nii""" 2352 2353 def run( 2354 self, 2355 execution: Execution, 2356 ) -> list[str]: 2357 """ 2358 Build command line arguments. This method is called by the main command. 2359 2360 Args: 2361 execution: The execution object. 2362 Returns: 2363 Command line arguments 2364 """ 2365 cargs = [] 2366 cargs.extend([ 2367 "-grad", 2368 self.gradient 2369 ]) 2370 return cargs
-grad, -gradient: Image gradient
Syntax -grad
Computes the gradient of the image. Each component of the gradient is placed on the stack in order (x,y,z). The gradient is computed in physical RAS coordinates, taking into account image spacing and orientation. In other words, the gradient is the vector in physical space orthogonal to the isocontours of the image. No smoothing is performed, so it is a good idea to smooth the image first before computing the gradient.
c3d myimage.nii -smooth 1.2vox -grad -oo grad_comp_%02d.nii.
-grad, -gradient: Image gradient
Syntax -grad
Computes the gradient of the image. Each component of the gradient is placed on the stack in order (x,y,z). The gradient is computed in physical RAS coordinates, taking into account image spacing and orientation. In other words, the gradient is the vector in physical space orthogonal to the isocontours of the image. No smoothing is performed, so it is a good idea to smooth the image first before computing the gradient.
c3d myimage.nii -smooth 1.2vox -grad -oo grad_comp_%02d.nii
2353 def run( 2354 self, 2355 execution: Execution, 2356 ) -> list[str]: 2357 """ 2358 Build command line arguments. This method is called by the main command. 2359 2360 Args: 2361 execution: The execution object. 2362 Returns: 2363 Command line arguments 2364 """ 2365 cargs = [] 2366 cargs.extend([ 2367 "-grad", 2368 self.gradient 2369 ]) 2370 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2373@dataclasses.dataclass 2374class C3dHelp: 2375 """ 2376 -hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix 2377 2378 Syntax `-hesseig <scale>` 2379 2380 Computes the Hessian matrix at every pixel of an image and the eigenvalues 2381 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 2382 the stack. These images are useful as texture features. See also the 2383 '''-steig''' command. The scale determines the amount of Gaussian smoothing 2384 applied for computing the partial derivatives in the Hessian, and is in 2385 physical (mm) units. 2386 2387 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz. 2388 """ 2389 v__help: str 2390 """-hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix 2391 2392 Syntax `-hesseig <scale>` 2393 2394 Computes the Hessian matrix at every pixel of an image and the eigenvalues 2395 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 2396 the stack. These images are useful as texture features. See also the 2397 '''-steig''' command. The scale determines the amount of Gaussian smoothing 2398 applied for computing the partial derivatives in the Hessian, and is in 2399 physical (mm) units. 2400 2401 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz""" 2402 2403 def run( 2404 self, 2405 execution: Execution, 2406 ) -> list[str]: 2407 """ 2408 Build command line arguments. This method is called by the main command. 2409 2410 Args: 2411 execution: The execution object. 2412 Returns: 2413 Command line arguments 2414 """ 2415 cargs = [] 2416 cargs.extend([ 2417 "-h", 2418 self.v__help 2419 ]) 2420 return cargs
-hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix
Syntax -hesseig <scale>
Computes the Hessian matrix at every pixel of an image and the eigenvalues of the Hessian. Images of the eigenvalues (sorted by value) are placed on the stack. These images are useful as texture features. See also the '''-steig''' command. The scale determines the amount of Gaussian smoothing applied for computing the partial derivatives in the Hessian, and is in physical (mm) units.
c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz.
-hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix
Syntax -hesseig <scale>
Computes the Hessian matrix at every pixel of an image and the eigenvalues of the Hessian. Images of the eigenvalues (sorted by value) are placed on the stack. These images are useful as texture features. See also the '''-steig''' command. The scale determines the amount of Gaussian smoothing applied for computing the partial derivatives in the Hessian, and is in physical (mm) units.
c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz
2403 def run( 2404 self, 2405 execution: Execution, 2406 ) -> list[str]: 2407 """ 2408 Build command line arguments. This method is called by the main command. 2409 2410 Args: 2411 execution: The execution object. 2412 Returns: 2413 Command line arguments 2414 """ 2415 cargs = [] 2416 cargs.extend([ 2417 "-h", 2418 self.v__help 2419 ]) 2420 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2479@dataclasses.dataclass 2480class C3dHessianEigenvalues: 2481 """ 2482 -hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix 2483 2484 Syntax `-hesseig <scale>` 2485 2486 Computes the Hessian matrix at every pixel of an image and the eigenvalues 2487 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 2488 the stack. These images are useful as texture features. See also the 2489 '''-steig''' command. The scale determines the amount of Gaussian smoothing 2490 applied for computing the partial derivatives in the Hessian, and is in 2491 physical (mm) units. 2492 2493 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz. 2494 """ 2495 hessian_eigenvalues: str 2496 """-hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix 2497 2498 Syntax `-hesseig <scale>` 2499 2500 Computes the Hessian matrix at every pixel of an image and the eigenvalues 2501 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 2502 the stack. These images are useful as texture features. See also the 2503 '''-steig''' command. The scale determines the amount of Gaussian smoothing 2504 applied for computing the partial derivatives in the Hessian, and is in 2505 physical (mm) units. 2506 2507 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz""" 2508 2509 def run( 2510 self, 2511 execution: Execution, 2512 ) -> list[str]: 2513 """ 2514 Build command line arguments. This method is called by the main command. 2515 2516 Args: 2517 execution: The execution object. 2518 Returns: 2519 Command line arguments 2520 """ 2521 cargs = [] 2522 cargs.extend([ 2523 "-hesseig", 2524 self.hessian_eigenvalues 2525 ]) 2526 return cargs
-hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix
Syntax -hesseig <scale>
Computes the Hessian matrix at every pixel of an image and the eigenvalues of the Hessian. Images of the eigenvalues (sorted by value) are placed on the stack. These images are useful as texture features. See also the '''-steig''' command. The scale determines the amount of Gaussian smoothing applied for computing the partial derivatives in the Hessian, and is in physical (mm) units.
c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz.
-hesseig, -hessian-eigenvalues: Compute eigenvalues of the Hessian matrix
Syntax -hesseig <scale>
Computes the Hessian matrix at every pixel of an image and the eigenvalues of the Hessian. Images of the eigenvalues (sorted by value) are placed on the stack. These images are useful as texture features. See also the '''-steig''' command. The scale determines the amount of Gaussian smoothing applied for computing the partial derivatives in the Hessian, and is in physical (mm) units.
c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz
2509 def run( 2510 self, 2511 execution: Execution, 2512 ) -> list[str]: 2513 """ 2514 Build command line arguments. This method is called by the main command. 2515 2516 Args: 2517 execution: The execution object. 2518 Returns: 2519 Command line arguments 2520 """ 2521 cargs = [] 2522 cargs.extend([ 2523 "-hesseig", 2524 self.hessian_eigenvalues 2525 ]) 2526 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2529@dataclasses.dataclass 2530class C3dHessianObjectness: 2531 """ 2532 -hessobj, -hessian-objectness: Hessian objectness filter 2533 2534 Syntax: `-hessobj <dimension> <min_scale> <max_scale>` 2535 2536 Also known as the Frangi vesselness filter, this filter can be used to 2537 highlight tube-like, sheet-like and blob-like objects in the image. For 2538 details, see documentation to the [corresponging ITK class][HTOMIF]. 2539 2540 Parameter `dimension` is an integer that determines the kind of features 2541 that are highlighed. Use 0 for blobs, 1 for tubes, 2 for pancakes, etc. The 2542 min and max scale parameters are floating point values, giving the scale of 2543 the features highlighted, in physical units. Typically, just one scale is 2544 used. 2545 2546 # Detect vessel-like structures at scale 0.5mm 2547 c3d image.nii.gz -hessobj 1 0.5 0.5 2548 2549 [HTOMIF] 2550 http://www.itk.org/Doxygen/html/classitk_1_1HessianToObjectnessMeasureImageFilter.html. 2551 """ 2552 hessian_objectness: str 2553 """-hessobj, -hessian-objectness: Hessian objectness filter 2554 2555 Syntax: `-hessobj <dimension> <min_scale> <max_scale>` 2556 2557 Also known as the Frangi vesselness filter, this filter can be used to 2558 highlight tube-like, sheet-like and blob-like objects in the image. For 2559 details, see documentation to the [corresponging ITK class][HTOMIF]. 2560 2561 Parameter `dimension` is an integer that determines the kind of features 2562 that are highlighed. Use 0 for blobs, 1 for tubes, 2 for pancakes, etc. The 2563 min and max scale parameters are floating point values, giving the scale of 2564 the features highlighted, in physical units. Typically, just one scale is 2565 used. 2566 2567 # Detect vessel-like structures at scale 0.5mm 2568 c3d image.nii.gz -hessobj 1 0.5 0.5 2569 2570 [HTOMIF] 2571 http://www.itk.org/Doxygen/html/classitk_1_1HessianToObjectnessMeasureImageFilter.html""" 2572 2573 def run( 2574 self, 2575 execution: Execution, 2576 ) -> list[str]: 2577 """ 2578 Build command line arguments. This method is called by the main command. 2579 2580 Args: 2581 execution: The execution object. 2582 Returns: 2583 Command line arguments 2584 """ 2585 cargs = [] 2586 cargs.extend([ 2587 "-hessobj", 2588 self.hessian_objectness 2589 ]) 2590 return cargs
-hessobj, -hessian-objectness: Hessian objectness filter
Syntax: -hessobj <dimension> <min_scale> <max_scale>
Also known as the Frangi vesselness filter, this filter can be used to highlight tube-like, sheet-like and blob-like objects in the image. For details, see documentation to the [corresponging ITK class][HTOMIF].
Parameter dimension is an integer that determines the kind of features
that are highlighed. Use 0 for blobs, 1 for tubes, 2 for pancakes, etc. The
min and max scale parameters are floating point values, giving the scale of
the features highlighted, in physical units. Typically, just one scale is
used.
Detect vessel-like structures at scale 0.5mm
c3d image.nii.gz -hessobj 1 0.5 0.5
[HTOMIF] http://www.itk.org/Doxygen/html/classitk_1_1HessianToObjectnessMeasureImageFilter.html.
-hessobj, -hessian-objectness: Hessian objectness filter
Syntax: -hessobj <dimension> <min_scale> <max_scale>
Also known as the Frangi vesselness filter, this filter can be used to highlight tube-like, sheet-like and blob-like objects in the image. For details, see documentation to the [corresponging ITK class][HTOMIF].
Parameter dimension is an integer that determines the kind of features
that are highlighed. Use 0 for blobs, 1 for tubes, 2 for pancakes, etc. The
min and max scale parameters are floating point values, giving the scale of
the features highlighted, in physical units. Typically, just one scale is
used.
Detect vessel-like structures at scale 0.5mm
c3d image.nii.gz -hessobj 1 0.5 0.5
[HTOMIF] http://www.itk.org/Doxygen/html/classitk_1_1HessianToObjectnessMeasureImageFilter.html
2573 def run( 2574 self, 2575 execution: Execution, 2576 ) -> list[str]: 2577 """ 2578 Build command line arguments. This method is called by the main command. 2579 2580 Args: 2581 execution: The execution object. 2582 Returns: 2583 Command line arguments 2584 """ 2585 cargs = [] 2586 cargs.extend([ 2587 "-hessobj", 2588 self.hessian_objectness 2589 ]) 2590 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2593@dataclasses.dataclass 2594class C3dHistogramMatch: 2595 """ 2596 No description found. 2597 """ 2598 histogram_match: str 2599 """No description found.""" 2600 2601 def run( 2602 self, 2603 execution: Execution, 2604 ) -> list[str]: 2605 """ 2606 Build command line arguments. This method is called by the main command. 2607 2608 Args: 2609 execution: The execution object. 2610 Returns: 2611 Command line arguments 2612 """ 2613 cargs = [] 2614 cargs.extend([ 2615 "-histmatch", 2616 self.histogram_match 2617 ]) 2618 return cargs
No description found.
2601 def run( 2602 self, 2603 execution: Execution, 2604 ) -> list[str]: 2605 """ 2606 Build command line arguments. This method is called by the main command. 2607 2608 Args: 2609 execution: The execution object. 2610 Returns: 2611 Command line arguments 2612 """ 2613 cargs = [] 2614 cargs.extend([ 2615 "-histmatch", 2616 self.histogram_match 2617 ]) 2618 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2423@dataclasses.dataclass 2424class C3dHolefill: 2425 """ 2426 -holefill: Fill holes in binary image 2427 2428 Syntax: `-holefill intensity_value [0|1] ` 2429 2430 Apply the binary hole filling algorithm to a particular intensity value in 2431 the image. The input image is typically a binary image or a multi-label 2432 segmentation image. Holes (voxels not matching the specified intensity value 2433 that are completely contained by voxels matching this value) are filled. The 2434 second parameter specifies what type of topological connectivity is used to 2435 determine holes. The value 0 uses the default algorithm in ITK (face 2436 connectivity) and 1 uses the full connectivity variant (face, edge and 2437 vertex connectivity). For more details see the [ITK page for this 2438 algorithm][7]. 2439 2440 c3d segmentation.nii.gz -holefill 5 0 -type uchar -o filledlabel5.nii.gz. 2441 """ 2442 holefill: str 2443 """-holefill: Fill holes in binary image 2444 2445 Syntax: `-holefill intensity_value [0|1] ` 2446 2447 Apply the binary hole filling algorithm to a particular intensity value in 2448 the image. The input image is typically a binary image or a multi-label 2449 segmentation image. Holes (voxels not matching the specified intensity value 2450 that are completely contained by voxels matching this value) are filled. The 2451 second parameter specifies what type of topological connectivity is used to 2452 determine holes. The value 0 uses the default algorithm in ITK (face 2453 connectivity) and 1 uses the full connectivity variant (face, edge and 2454 vertex connectivity). For more details see the [ITK page for this 2455 algorithm][7]. 2456 2457 c3d segmentation.nii.gz -holefill 5 0 -type uchar -o filledlabel5.nii.gz""" 2458 2459 def run( 2460 self, 2461 execution: Execution, 2462 ) -> list[str]: 2463 """ 2464 Build command line arguments. This method is called by the main command. 2465 2466 Args: 2467 execution: The execution object. 2468 Returns: 2469 Command line arguments 2470 """ 2471 cargs = [] 2472 cargs.extend([ 2473 "-hf", 2474 self.holefill 2475 ]) 2476 return cargs
-holefill: Fill holes in binary image
Syntax: -holefill intensity_value [0|1]
Apply the binary hole filling algorithm to a particular intensity value in the image. The input image is typically a binary image or a multi-label segmentation image. Holes (voxels not matching the specified intensity value that are completely contained by voxels matching this value) are filled. The second parameter specifies what type of topological connectivity is used to determine holes. The value 0 uses the default algorithm in ITK (face connectivity) and 1 uses the full connectivity variant (face, edge and vertex connectivity). For more details see the [ITK page for this algorithm][7].
c3d segmentation.nii.gz -holefill 5 0 -type uchar -o filledlabel5.nii.gz.
-holefill: Fill holes in binary image
Syntax: -holefill intensity_value [0|1]
Apply the binary hole filling algorithm to a particular intensity value in the image. The input image is typically a binary image or a multi-label segmentation image. Holes (voxels not matching the specified intensity value that are completely contained by voxels matching this value) are filled. The second parameter specifies what type of topological connectivity is used to determine holes. The value 0 uses the default algorithm in ITK (face connectivity) and 1 uses the full connectivity variant (face, edge and vertex connectivity). For more details see the [ITK page for this algorithm][7].
c3d segmentation.nii.gz -holefill 5 0 -type uchar -o filledlabel5.nii.gz
2459 def run( 2460 self, 2461 execution: Execution, 2462 ) -> list[str]: 2463 """ 2464 Build command line arguments. This method is called by the main command. 2465 2466 Args: 2467 execution: The execution object. 2468 Returns: 2469 Command line arguments 2470 """ 2471 cargs = [] 2472 cargs.extend([ 2473 "-hf", 2474 self.holefill 2475 ]) 2476 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2621@dataclasses.dataclass 2622class C3dInfo: 2623 """ 2624 -info: Display brief image information 2625 2626 Syntax: `-info` 2627 2628 Prints brief information about the last image on the stack. Does not affect 2629 the stack. 2630 2631 c3d image.hdr -info 2632 2633 Use with the **-foreach** command to get information on multiple images 2634 2635 c3d images*.nii -foreach -info -endfor. 2636 """ 2637 info: str 2638 """-info: Display brief image information 2639 2640 Syntax: `-info` 2641 2642 Prints brief information about the last image on the stack. Does not affect 2643 the stack. 2644 2645 c3d image.hdr -info 2646 2647 Use with the **-foreach** command to get information on multiple images 2648 2649 c3d images*.nii -foreach -info -endfor""" 2650 2651 def run( 2652 self, 2653 execution: Execution, 2654 ) -> list[str]: 2655 """ 2656 Build command line arguments. This method is called by the main command. 2657 2658 Args: 2659 execution: The execution object. 2660 Returns: 2661 Command line arguments 2662 """ 2663 cargs = [] 2664 cargs.extend([ 2665 "-info", 2666 self.info 2667 ]) 2668 return cargs
-info: Display brief image information
Syntax: -info
Prints brief information about the last image on the stack. Does not affect the stack.
c3d image.hdr -info
Use with the -foreach command to get information on multiple images
c3d images*.nii -foreach -info -endfor.
-info: Display brief image information
Syntax: -info
Prints brief information about the last image on the stack. Does not affect the stack.
c3d image.hdr -info
Use with the -foreach command to get information on multiple images
c3d images*.nii -foreach -info -endfor
2651 def run( 2652 self, 2653 execution: Execution, 2654 ) -> list[str]: 2655 """ 2656 Build command line arguments. This method is called by the main command. 2657 2658 Args: 2659 execution: The execution object. 2660 Returns: 2661 Command line arguments 2662 """ 2663 cargs = [] 2664 cargs.extend([ 2665 "-info", 2666 self.info 2667 ]) 2668 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2671@dataclasses.dataclass 2672class C3dInfoFull: 2673 """ 2674 -info-full: Display verbose image information 2675 2676 Syntax: `-info-full` 2677 2678 Prints extended information about the last image on the stack, such as the 2679 metadata dictionary. For example, 2680 2681 c3d image.hdr -info-full. 2682 """ 2683 info_full: str 2684 """-info-full: Display verbose image information 2685 2686 Syntax: `-info-full` 2687 2688 Prints extended information about the last image on the stack, such as the 2689 metadata dictionary. For example, 2690 2691 c3d image.hdr -info-full""" 2692 2693 def run( 2694 self, 2695 execution: Execution, 2696 ) -> list[str]: 2697 """ 2698 Build command line arguments. This method is called by the main command. 2699 2700 Args: 2701 execution: The execution object. 2702 Returns: 2703 Command line arguments 2704 """ 2705 cargs = [] 2706 cargs.extend([ 2707 "-info-full", 2708 self.info_full 2709 ]) 2710 return cargs
-info-full: Display verbose image information
Syntax: -info-full
Prints extended information about the last image on the stack, such as the metadata dictionary. For example,
c3d image.hdr -info-full.
-info-full: Display verbose image information
Syntax: -info-full
Prints extended information about the last image on the stack, such as the metadata dictionary. For example,
c3d image.hdr -info-full
2693 def run( 2694 self, 2695 execution: Execution, 2696 ) -> list[str]: 2697 """ 2698 Build command line arguments. This method is called by the main command. 2699 2700 Args: 2701 execution: The execution object. 2702 Returns: 2703 Command line arguments 2704 """ 2705 cargs = [] 2706 cargs.extend([ 2707 "-info-full", 2708 self.info_full 2709 ]) 2710 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2713@dataclasses.dataclass 2714class C3dInsert: 2715 """ 2716 -insert: Insert image anywhere in the stack 2717 2718 Syntax: `-insert var pos` 2719 2720 This command is similar to **-push**, but allows you to insert the image 2721 associated with 'var' at any position in the stack, counting from the end. 2722 When 'pos' is 0, the image is placed at the end of the stack (same as 2723 **-push**). When pos is one, the image is placed at the next-to-end 2724 position, and so on. 2725 """ 2726 insert: str 2727 """-insert: Insert image anywhere in the stack 2728 2729 Syntax: `-insert var pos` 2730 2731 This command is similar to **-push**, but allows you to insert the image 2732 associated with 'var' at any position in the stack, counting from the end. 2733 When 'pos' is 0, the image is placed at the end of the stack (same as 2734 **-push**). When pos is one, the image is placed at the next-to-end 2735 position, and so on.""" 2736 2737 def run( 2738 self, 2739 execution: Execution, 2740 ) -> list[str]: 2741 """ 2742 Build command line arguments. This method is called by the main command. 2743 2744 Args: 2745 execution: The execution object. 2746 Returns: 2747 Command line arguments 2748 """ 2749 cargs = [] 2750 cargs.extend([ 2751 "-insert", 2752 self.insert 2753 ]) 2754 return cargs
-insert: Insert image anywhere in the stack
Syntax: -insert var pos
This command is similar to -push, but allows you to insert the image associated with 'var' at any position in the stack, counting from the end. When 'pos' is 0, the image is placed at the end of the stack (same as -push). When pos is one, the image is placed at the next-to-end position, and so on.
-insert: Insert image anywhere in the stack
Syntax: -insert var pos
This command is similar to -push, but allows you to insert the image associated with 'var' at any position in the stack, counting from the end. When 'pos' is 0, the image is placed at the end of the stack (same as -push). When pos is one, the image is placed at the next-to-end position, and so on.
2737 def run( 2738 self, 2739 execution: Execution, 2740 ) -> list[str]: 2741 """ 2742 Build command line arguments. This method is called by the main command. 2743 2744 Args: 2745 execution: The execution object. 2746 Returns: 2747 Command line arguments 2748 """ 2749 cargs = [] 2750 cargs.extend([ 2751 "-insert", 2752 self.insert 2753 ]) 2754 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2757@dataclasses.dataclass 2758class C3dInterpolation: 2759 """ 2760 -interpolation: Set interpolation mode 2761 2762 Syntax: `-interpolation <NearestNeighbor|Linear|Cubic|Sinc|Gaussian> 2763 [param]` 2764 2765 Specifies the interpolation used with **-resample** and other commands. 2766 Default is **Linear**. Gaussian interpolation takes as the parameter the 2767 standard deviation of the Gaussian filter (e.g, 1mm). Gaussian interpolation 2768 is very similar in result to first smoothing an image with a Gaussian filter 2769 and then reslicing it with linear interpolation, but is more accurate and 2770 has less aliasing artifacts. It is also slower, and should only be used with 2771 small sigmas (a few voxels across). 2772 2773 Shorthand 0 can be used for *NearestNeighbor*, 1 for *Linear* and 3 for 2774 *Cubic*. For example: 2775 2776 c3d -int 3 test.nii -resample 200x200x200% -o cubic_supersample.nii. 2777 """ 2778 interpolation: str 2779 """-interpolation: Set interpolation mode 2780 2781 Syntax: `-interpolation <NearestNeighbor|Linear|Cubic|Sinc|Gaussian> 2782 [param]` 2783 2784 Specifies the interpolation used with **-resample** and other commands. 2785 Default is **Linear**. Gaussian interpolation takes as the parameter the 2786 standard deviation of the Gaussian filter (e.g, 1mm). Gaussian interpolation 2787 is very similar in result to first smoothing an image with a Gaussian filter 2788 and then reslicing it with linear interpolation, but is more accurate and 2789 has less aliasing artifacts. It is also slower, and should only be used with 2790 small sigmas (a few voxels across). 2791 2792 Shorthand 0 can be used for *NearestNeighbor*, 1 for *Linear* and 3 for 2793 *Cubic*. For example: 2794 2795 c3d -int 3 test.nii -resample 200x200x200% -o cubic_supersample.nii""" 2796 2797 def run( 2798 self, 2799 execution: Execution, 2800 ) -> list[str]: 2801 """ 2802 Build command line arguments. This method is called by the main command. 2803 2804 Args: 2805 execution: The execution object. 2806 Returns: 2807 Command line arguments 2808 """ 2809 cargs = [] 2810 cargs.extend([ 2811 "-interpolation", 2812 self.interpolation 2813 ]) 2814 return cargs
-interpolation: Set interpolation mode
Syntax: -interpolation <NearestNeighbor|Linear|Cubic|Sinc|Gaussian>
[param]
Specifies the interpolation used with -resample and other commands. Default is Linear. Gaussian interpolation takes as the parameter the standard deviation of the Gaussian filter (e.g, 1mm). Gaussian interpolation is very similar in result to first smoothing an image with a Gaussian filter and then reslicing it with linear interpolation, but is more accurate and has less aliasing artifacts. It is also slower, and should only be used with small sigmas (a few voxels across).
Shorthand 0 can be used for NearestNeighbor, 1 for Linear and 3 for Cubic. For example:
c3d -int 3 test.nii -resample 200x200x200% -o cubic_supersample.nii.
-interpolation: Set interpolation mode
Syntax: -interpolation <NearestNeighbor|Linear|Cubic|Sinc|Gaussian>
[param]
Specifies the interpolation used with -resample and other commands. Default is Linear. Gaussian interpolation takes as the parameter the standard deviation of the Gaussian filter (e.g, 1mm). Gaussian interpolation is very similar in result to first smoothing an image with a Gaussian filter and then reslicing it with linear interpolation, but is more accurate and has less aliasing artifacts. It is also slower, and should only be used with small sigmas (a few voxels across).
Shorthand 0 can be used for NearestNeighbor, 1 for Linear and 3 for Cubic. For example:
c3d -int 3 test.nii -resample 200x200x200% -o cubic_supersample.nii
2797 def run( 2798 self, 2799 execution: Execution, 2800 ) -> list[str]: 2801 """ 2802 Build command line arguments. This method is called by the main command. 2803 2804 Args: 2805 execution: The execution object. 2806 Returns: 2807 Command line arguments 2808 """ 2809 cargs = [] 2810 cargs.extend([ 2811 "-interpolation", 2812 self.interpolation 2813 ]) 2814 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2817@dataclasses.dataclass 2818class C3dIterations: 2819 """ 2820 No description found. 2821 """ 2822 iterations: str 2823 """No description found.""" 2824 2825 def run( 2826 self, 2827 execution: Execution, 2828 ) -> list[str]: 2829 """ 2830 Build command line arguments. This method is called by the main command. 2831 2832 Args: 2833 execution: The execution object. 2834 Returns: 2835 Command line arguments 2836 """ 2837 cargs = [] 2838 cargs.extend([ 2839 "-iterations", 2840 self.iterations 2841 ]) 2842 return cargs
No description found.
2825 def run( 2826 self, 2827 execution: Execution, 2828 ) -> list[str]: 2829 """ 2830 Build command line arguments. This method is called by the main command. 2831 2832 Args: 2833 execution: The execution object. 2834 Returns: 2835 Command line arguments 2836 """ 2837 cargs = [] 2838 cargs.extend([ 2839 "-iterations", 2840 self.iterations 2841 ]) 2842 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2845@dataclasses.dataclass 2846class C3dLabelOverlap: 2847 """ 2848 No description found. 2849 """ 2850 label_overlap: str 2851 """No description found.""" 2852 2853 def run( 2854 self, 2855 execution: Execution, 2856 ) -> list[str]: 2857 """ 2858 Build command line arguments. This method is called by the main command. 2859 2860 Args: 2861 execution: The execution object. 2862 Returns: 2863 Command line arguments 2864 """ 2865 cargs = [] 2866 cargs.extend([ 2867 "-label-overlap", 2868 self.label_overlap 2869 ]) 2870 return cargs
No description found.
2853 def run( 2854 self, 2855 execution: Execution, 2856 ) -> list[str]: 2857 """ 2858 Build command line arguments. This method is called by the main command. 2859 2860 Args: 2861 execution: The execution object. 2862 Returns: 2863 Command line arguments 2864 """ 2865 cargs = [] 2866 cargs.extend([ 2867 "-label-overlap", 2868 self.label_overlap 2869 ]) 2870 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2873@dataclasses.dataclass 2874class C3dLabelStatistics: 2875 """ 2876 -lstat, -label-statistics: Display segmentation volumes and intensity 2877 statistics 2878 2879 Syntax: `-lstat` 2880 2881 Given a grayscale image and a multilabel (or binary) image, this command 2882 computes the statistics for every label in the latter, including volumes, 2883 average grayscale intensity, etc. For instance, if image *mri.nii* is a 2884 medical image and *seg.nii* is a multilabel segmentation of the image with 2885 labels 0, 1 and 4, the following command can be used to print the statistics 2886 of the intensity of *mri.nii* for each of the labels 2887 2888 c3d mri.nii seg.nii -lstat 2889 2890 The output contains the mean, standard deviation, maximum intensity and 2891 minimum intensity for each label. If you just need volumes from a 2892 multi-label image, use **-dup** command as follows: 2893 2894 c3d seg.nii -dup -lstat. 2895 """ 2896 label_statistics: str 2897 """-lstat, -label-statistics: Display segmentation volumes and intensity 2898 statistics 2899 2900 Syntax: `-lstat` 2901 2902 Given a grayscale image and a multilabel (or binary) image, this command 2903 computes the statistics for every label in the latter, including volumes, 2904 average grayscale intensity, etc. For instance, if image *mri.nii* is a 2905 medical image and *seg.nii* is a multilabel segmentation of the image with 2906 labels 0, 1 and 4, the following command can be used to print the statistics 2907 of the intensity of *mri.nii* for each of the labels 2908 2909 c3d mri.nii seg.nii -lstat 2910 2911 The output contains the mean, standard deviation, maximum intensity and 2912 minimum intensity for each label. If you just need volumes from a 2913 multi-label image, use **-dup** command as follows: 2914 2915 c3d seg.nii -dup -lstat""" 2916 2917 def run( 2918 self, 2919 execution: Execution, 2920 ) -> list[str]: 2921 """ 2922 Build command line arguments. This method is called by the main command. 2923 2924 Args: 2925 execution: The execution object. 2926 Returns: 2927 Command line arguments 2928 """ 2929 cargs = [] 2930 cargs.extend([ 2931 "-label-statistics", 2932 self.label_statistics 2933 ]) 2934 return cargs
-lstat, -label-statistics: Display segmentation volumes and intensity statistics
Syntax: -lstat
Given a grayscale image and a multilabel (or binary) image, this command computes the statistics for every label in the latter, including volumes, average grayscale intensity, etc. For instance, if image mri.nii is a medical image and seg.nii is a multilabel segmentation of the image with labels 0, 1 and 4, the following command can be used to print the statistics of the intensity of mri.nii for each of the labels
c3d mri.nii seg.nii -lstat
The output contains the mean, standard deviation, maximum intensity and minimum intensity for each label. If you just need volumes from a multi-label image, use -dup command as follows:
c3d seg.nii -dup -lstat.
-lstat, -label-statistics: Display segmentation volumes and intensity statistics
Syntax: -lstat
Given a grayscale image and a multilabel (or binary) image, this command computes the statistics for every label in the latter, including volumes, average grayscale intensity, etc. For instance, if image mri.nii is a medical image and seg.nii is a multilabel segmentation of the image with labels 0, 1 and 4, the following command can be used to print the statistics of the intensity of mri.nii for each of the labels
c3d mri.nii seg.nii -lstat
The output contains the mean, standard deviation, maximum intensity and minimum intensity for each label. If you just need volumes from a multi-label image, use -dup command as follows:
c3d seg.nii -dup -lstat
2917 def run( 2918 self, 2919 execution: Execution, 2920 ) -> list[str]: 2921 """ 2922 Build command line arguments. This method is called by the main command. 2923 2924 Args: 2925 execution: The execution object. 2926 Returns: 2927 Command line arguments 2928 """ 2929 cargs = [] 2930 cargs.extend([ 2931 "-label-statistics", 2932 self.label_statistics 2933 ]) 2934 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2937@dataclasses.dataclass 2938class C3dLandmarksToSpheres: 2939 """ 2940 No description found. 2941 """ 2942 landmarks_to_spheres: str 2943 """No description found.""" 2944 2945 def run( 2946 self, 2947 execution: Execution, 2948 ) -> list[str]: 2949 """ 2950 Build command line arguments. This method is called by the main command. 2951 2952 Args: 2953 execution: The execution object. 2954 Returns: 2955 Command line arguments 2956 """ 2957 cargs = [] 2958 cargs.extend([ 2959 "-landmarks-to-spheres", 2960 self.landmarks_to_spheres 2961 ]) 2962 return cargs
No description found.
2945 def run( 2946 self, 2947 execution: Execution, 2948 ) -> list[str]: 2949 """ 2950 Build command line arguments. This method is called by the main command. 2951 2952 Args: 2953 execution: The execution object. 2954 Returns: 2955 Command line arguments 2956 """ 2957 cargs = [] 2958 cargs.extend([ 2959 "-landmarks-to-spheres", 2960 self.landmarks_to_spheres 2961 ]) 2962 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
2965@dataclasses.dataclass 2966class C3dLaplacian: 2967 """ 2968 -laplacian, -laplace: Laplacian filter 2969 2970 Syntax: `-laplacian` 2971 2972 Applies the Laplacian filter to the image. Used to detect ridges of 2973 intensity. Typically, used with the **-smooth** option to obtain the 2974 equivalent of convolving the image with the *Laplacian of the Gaussian 2975 (LoG)* kernel: 2976 2977 c3d input.img -smooth 1.2vox -laplacian -o output.img. 2978 """ 2979 laplacian: str 2980 """-laplacian, -laplace: Laplacian filter 2981 2982 Syntax: `-laplacian` 2983 2984 Applies the Laplacian filter to the image. Used to detect ridges of 2985 intensity. Typically, used with the **-smooth** option to obtain the 2986 equivalent of convolving the image with the *Laplacian of the Gaussian 2987 (LoG)* kernel: 2988 2989 c3d input.img -smooth 1.2vox -laplacian -o output.img""" 2990 2991 def run( 2992 self, 2993 execution: Execution, 2994 ) -> list[str]: 2995 """ 2996 Build command line arguments. This method is called by the main command. 2997 2998 Args: 2999 execution: The execution object. 3000 Returns: 3001 Command line arguments 3002 """ 3003 cargs = [] 3004 cargs.extend([ 3005 "-laplacian", 3006 self.laplacian 3007 ]) 3008 return cargs
-laplacian, -laplace: Laplacian filter
Syntax: -laplacian
Applies the Laplacian filter to the image. Used to detect ridges of intensity. Typically, used with the -smooth option to obtain the equivalent of convolving the image with the Laplacian of the Gaussian (LoG) kernel:
c3d input.img -smooth 1.2vox -laplacian -o output.img.
-laplacian, -laplace: Laplacian filter
Syntax: -laplacian
Applies the Laplacian filter to the image. Used to detect ridges of intensity. Typically, used with the -smooth option to obtain the equivalent of convolving the image with the Laplacian of the Gaussian (LoG) kernel:
c3d input.img -smooth 1.2vox -laplacian -o output.img
2991 def run( 2992 self, 2993 execution: Execution, 2994 ) -> list[str]: 2995 """ 2996 Build command line arguments. This method is called by the main command. 2997 2998 Args: 2999 execution: The execution object. 3000 Returns: 3001 Command line arguments 3002 """ 3003 cargs = [] 3004 cargs.extend([ 3005 "-laplacian", 3006 self.laplacian 3007 ]) 3008 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3011@dataclasses.dataclass 3012class C3dLevelset: 3013 """ 3014 -levelset: Level set segmentation 3015 3016 Syntax: `-levelset n_iter ` 3017 3018 Perform level set segmentation for *n\_iter* iterations, like in ITK-SNAP. 3019 The last image on the stack is treated as the initialization image and the 3020 next-to-last image on the stack is the speed image. Both images should be in 3021 the range between -1 and 1. Here is how the signs of the different images 3022 are interpreted 3023 3024 | | Speed Image | Initialization Image | Output Image | 3025 | -- | ------------- | -------------------- | ------------ | 3026 | +1 | Foreground | Outside | Outside | 3027 | -1 | Background | Inside | Inside | 3028 3029 Here is an example where you have the speed and the initialization given: 3030 3031 c3d speed.img initial.img -levelset-curvature 0.5 -levelset 100 -o seg.img 3032 3033 Here is an example of segmenting the ventricles in an MRI image, where the 3034 ventricles and other CSF have intensity below 715. The image 3035 seg_bubbles.nii.gz in this example is a binary image of the initialization 3036 seeds (1 inside the seeds, 0 outside). 3037 3038 c3d brain.nii.gz -erf 715 100 -scale -1 seg_bubbles.nii.gz \ 3039 -replace 0 1 1 -1 -levelset-curvature 0.2 -levelset 500 \ 3040 -thresh -inf 0 1 0 -o segmentation.nii.gz 3041 3042 Another example of smoothing a binary image that is useful for cleaning up 3043 manual segmentations. Here the speed image is positive inside the binary 3044 object, and the initialization is negative inside the object. The command 3045 writes out both the level set image (whose 0-level set is the smoothed 3046 boundary of the binary object) and the smoothed binary object 3047 3048 c3d binary.img -threshold 1 inf 1 -1 -binary.img 1 inf 1 -1 \ 3049 -levelset-curvature 1.5 -levelset 100 -o levelset.img \ 3050 -thresh -inf 0 1 0 -o smoothed_binary.img. 3051 """ 3052 levelset: str 3053 """-levelset: Level set segmentation 3054 3055 Syntax: `-levelset n_iter ` 3056 3057 Perform level set segmentation for *n\_iter* iterations, like in ITK-SNAP. 3058 The last image on the stack is treated as the initialization image and the 3059 next-to-last image on the stack is the speed image. Both images should be in 3060 the range between -1 and 1. Here is how the signs of the different images 3061 are interpreted 3062 3063 | | Speed Image | Initialization Image | Output Image | 3064 | -- | ------------- | -------------------- | ------------ | 3065 | +1 | Foreground | Outside | Outside | 3066 | -1 | Background | Inside | Inside | 3067 3068 Here is an example where you have the speed and the initialization given: 3069 3070 c3d speed.img initial.img -levelset-curvature 0.5 -levelset 100 -o seg.img 3071 3072 Here is an example of segmenting the ventricles in an MRI image, where the 3073 ventricles and other CSF have intensity below 715. The image 3074 seg_bubbles.nii.gz in this example is a binary image of the initialization 3075 seeds (1 inside the seeds, 0 outside). 3076 3077 c3d brain.nii.gz -erf 715 100 -scale -1 seg_bubbles.nii.gz \ 3078 -replace 0 1 1 -1 -levelset-curvature 0.2 -levelset 500 \ 3079 -thresh -inf 0 1 0 -o segmentation.nii.gz 3080 3081 Another example of smoothing a binary image that is useful for cleaning up 3082 manual segmentations. Here the speed image is positive inside the binary 3083 object, and the initialization is negative inside the object. The command 3084 writes out both the level set image (whose 0-level set is the smoothed 3085 boundary of the binary object) and the smoothed binary object 3086 3087 c3d binary.img -threshold 1 inf 1 -1 -binary.img 1 inf 1 -1 \ 3088 -levelset-curvature 1.5 -levelset 100 -o levelset.img \ 3089 -thresh -inf 0 1 0 -o smoothed_binary.img""" 3090 3091 def run( 3092 self, 3093 execution: Execution, 3094 ) -> list[str]: 3095 """ 3096 Build command line arguments. This method is called by the main command. 3097 3098 Args: 3099 execution: The execution object. 3100 Returns: 3101 Command line arguments 3102 """ 3103 cargs = [] 3104 cargs.extend([ 3105 "-levelset", 3106 self.levelset 3107 ]) 3108 return cargs
-levelset: Level set segmentation
Syntax: -levelset n_iter
Perform level set segmentation for n_iter iterations, like in ITK-SNAP. The last image on the stack is treated as the initialization image and the next-to-last image on the stack is the speed image. Both images should be in the range between -1 and 1. Here is how the signs of the different images are interpreted
| Speed Image | Initialization Image | Output Image | |
|---|---|---|---|
| +1 | Foreground | Outside | Outside |
| -1 | Background | Inside | Inside |
Here is an example where you have the speed and the initialization given:
c3d speed.img initial.img -levelset-curvature 0.5 -levelset 100 -o seg.img
Here is an example of segmenting the ventricles in an MRI image, where the ventricles and other CSF have intensity below 715. The image seg_bubbles.nii.gz in this example is a binary image of the initialization seeds (1 inside the seeds, 0 outside).
c3d brain.nii.gz -erf 715 100 -scale -1 seg_bubbles.nii.gz -replace 0 1 1 -1 -levelset-curvature 0.2 -levelset 500 -thresh -inf 0 1 0 -o segmentation.nii.gz
Another example of smoothing a binary image that is useful for cleaning up manual segmentations. Here the speed image is positive inside the binary object, and the initialization is negative inside the object. The command writes out both the level set image (whose 0-level set is the smoothed boundary of the binary object) and the smoothed binary object
c3d binary.img -threshold 1 inf 1 -1 -binary.img 1 inf 1 -1 -levelset-curvature 1.5 -levelset 100 -o levelset.img -thresh -inf 0 1 0 -o smoothed_binary.img.
-levelset: Level set segmentation
Syntax: -levelset n_iter
Perform level set segmentation for n_iter iterations, like in ITK-SNAP. The last image on the stack is treated as the initialization image and the next-to-last image on the stack is the speed image. Both images should be in the range between -1 and 1. Here is how the signs of the different images are interpreted
| Speed Image | Initialization Image | Output Image | |
|---|---|---|---|
| +1 | Foreground | Outside | Outside |
| -1 | Background | Inside | Inside |
Here is an example where you have the speed and the initialization given:
c3d speed.img initial.img -levelset-curvature 0.5 -levelset 100 -o seg.img
Here is an example of segmenting the ventricles in an MRI image, where the ventricles and other CSF have intensity below 715. The image seg_bubbles.nii.gz in this example is a binary image of the initialization seeds (1 inside the seeds, 0 outside).
c3d brain.nii.gz -erf 715 100 -scale -1 seg_bubbles.nii.gz -replace 0 1 1 -1 -levelset-curvature 0.2 -levelset 500 -thresh -inf 0 1 0 -o segmentation.nii.gz
Another example of smoothing a binary image that is useful for cleaning up manual segmentations. Here the speed image is positive inside the binary object, and the initialization is negative inside the object. The command writes out both the level set image (whose 0-level set is the smoothed boundary of the binary object) and the smoothed binary object
c3d binary.img -threshold 1 inf 1 -1 -binary.img 1 inf 1 -1 -levelset-curvature 1.5 -levelset 100 -o levelset.img -thresh -inf 0 1 0 -o smoothed_binary.img
3091 def run( 3092 self, 3093 execution: Execution, 3094 ) -> list[str]: 3095 """ 3096 Build command line arguments. This method is called by the main command. 3097 3098 Args: 3099 execution: The execution object. 3100 Returns: 3101 Command line arguments 3102 """ 3103 cargs = [] 3104 cargs.extend([ 3105 "-levelset", 3106 self.levelset 3107 ]) 3108 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3139@dataclasses.dataclass 3140class C3dLevelsetAdvection: 3141 """ 3142 No description found. 3143 """ 3144 levelset_advection: str 3145 """No description found.""" 3146 3147 def run( 3148 self, 3149 execution: Execution, 3150 ) -> list[str]: 3151 """ 3152 Build command line arguments. This method is called by the main command. 3153 3154 Args: 3155 execution: The execution object. 3156 Returns: 3157 Command line arguments 3158 """ 3159 cargs = [] 3160 cargs.extend([ 3161 "-levelset-advection", 3162 self.levelset_advection 3163 ]) 3164 return cargs
No description found.
3147 def run( 3148 self, 3149 execution: Execution, 3150 ) -> list[str]: 3151 """ 3152 Build command line arguments. This method is called by the main command. 3153 3154 Args: 3155 execution: The execution object. 3156 Returns: 3157 Command line arguments 3158 """ 3159 cargs = [] 3160 cargs.extend([ 3161 "-levelset-advection", 3162 self.levelset_advection 3163 ]) 3164 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3111@dataclasses.dataclass 3112class C3dLevelsetCurvature: 3113 """ 3114 No description found. 3115 """ 3116 levelset_curvature: str 3117 """No description found.""" 3118 3119 def run( 3120 self, 3121 execution: Execution, 3122 ) -> list[str]: 3123 """ 3124 Build command line arguments. This method is called by the main command. 3125 3126 Args: 3127 execution: The execution object. 3128 Returns: 3129 Command line arguments 3130 """ 3131 cargs = [] 3132 cargs.extend([ 3133 "-levelset-curvature", 3134 self.levelset_curvature 3135 ]) 3136 return cargs
No description found.
3119 def run( 3120 self, 3121 execution: Execution, 3122 ) -> list[str]: 3123 """ 3124 Build command line arguments. This method is called by the main command. 3125 3126 Args: 3127 execution: The execution object. 3128 Returns: 3129 Command line arguments 3130 """ 3131 cargs = [] 3132 cargs.extend([ 3133 "-levelset-curvature", 3134 self.levelset_curvature 3135 ]) 3136 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3167@dataclasses.dataclass 3168class C3dLog: 3169 """ 3170 -log, -ln: Voxelwise natural logarithm 3171 3172 Syntax: `-log` 3173 3174 Computes natural logarithm of each voxel in the last image on the stack. 3175 """ 3176 log: str 3177 """-log, -ln: Voxelwise natural logarithm 3178 3179 Syntax: `-log` 3180 3181 Computes natural logarithm of each voxel in the last image on the stack.""" 3182 3183 def run( 3184 self, 3185 execution: Execution, 3186 ) -> list[str]: 3187 """ 3188 Build command line arguments. This method is called by the main command. 3189 3190 Args: 3191 execution: The execution object. 3192 Returns: 3193 Command line arguments 3194 """ 3195 cargs = [] 3196 cargs.extend([ 3197 "-ln", 3198 self.log 3199 ]) 3200 return cargs
-log, -ln: Voxelwise natural logarithm
Syntax: -log
Computes natural logarithm of each voxel in the last image on the stack.
-log, -ln: Voxelwise natural logarithm
Syntax: -log
Computes natural logarithm of each voxel in the last image on the stack.
3183 def run( 3184 self, 3185 execution: Execution, 3186 ) -> list[str]: 3187 """ 3188 Build command line arguments. This method is called by the main command. 3189 3190 Args: 3191 execution: The execution object. 3192 Returns: 3193 Command line arguments 3194 """ 3195 cargs = [] 3196 cargs.extend([ 3197 "-ln", 3198 self.log 3199 ]) 3200 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3203@dataclasses.dataclass 3204class C3dLog10: 3205 """ 3206 -log10: Voxelwise base 10 logarithm 3207 3208 Syntax: `-log10` 3209 3210 Computes base 10 logarithm of each voxel in the last image on the stack. 3211 """ 3212 log10: str 3213 """-log10: Voxelwise base 10 logarithm 3214 3215 Syntax: `-log10` 3216 3217 Computes base 10 logarithm of each voxel in the last image on the stack.""" 3218 3219 def run( 3220 self, 3221 execution: Execution, 3222 ) -> list[str]: 3223 """ 3224 Build command line arguments. This method is called by the main command. 3225 3226 Args: 3227 execution: The execution object. 3228 Returns: 3229 Command line arguments 3230 """ 3231 cargs = [] 3232 cargs.extend([ 3233 "-log10", 3234 self.log10 3235 ]) 3236 return cargs
-log10: Voxelwise base 10 logarithm
Syntax: -log10
Computes base 10 logarithm of each voxel in the last image on the stack.
-log10: Voxelwise base 10 logarithm
Syntax: -log10
Computes base 10 logarithm of each voxel in the last image on the stack.
3219 def run( 3220 self, 3221 execution: Execution, 3222 ) -> list[str]: 3223 """ 3224 Build command line arguments. This method is called by the main command. 3225 3226 Args: 3227 execution: The execution object. 3228 Returns: 3229 Command line arguments 3230 """ 3231 cargs = [] 3232 cargs.extend([ 3233 "-log10", 3234 self.log10 3235 ]) 3236 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3239@dataclasses.dataclass 3240class C3dManual: 3241 """ 3242 No description found. 3243 """ 3244 manual: str 3245 """No description found.""" 3246 3247 def run( 3248 self, 3249 execution: Execution, 3250 ) -> list[str]: 3251 """ 3252 Build command line arguments. This method is called by the main command. 3253 3254 Args: 3255 execution: The execution object. 3256 Returns: 3257 Command line arguments 3258 """ 3259 cargs = [] 3260 cargs.extend([ 3261 "-manual", 3262 self.manual 3263 ]) 3264 return cargs
No description found.
3247 def run( 3248 self, 3249 execution: Execution, 3250 ) -> list[str]: 3251 """ 3252 Build command line arguments. This method is called by the main command. 3253 3254 Args: 3255 execution: The execution object. 3256 Returns: 3257 Command line arguments 3258 """ 3259 cargs = [] 3260 cargs.extend([ 3261 "-manual", 3262 self.manual 3263 ]) 3264 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3267@dataclasses.dataclass 3268class C3dMatchBoundingBox: 3269 """ 3270 -mbb, -match-bounding-box: Match bounding box of one image to another 3271 3272 Syntax: `-mbb` 3273 3274 Given two images on the stack (reference and target), sets the header of the 3275 target image so that the two images occupy the same physical space. The 3276 direction cosines of the target image are set to match the reference image. 3277 This command is related to '-copy-transform' but supports images of 3278 different size. 3279 3280 c3d reference.nii target.nii -mbb -o out.nii. 3281 """ 3282 match_bounding_box: str 3283 """-mbb, -match-bounding-box: Match bounding box of one image to another 3284 3285 Syntax: `-mbb` 3286 3287 Given two images on the stack (reference and target), sets the header of the 3288 target image so that the two images occupy the same physical space. The 3289 direction cosines of the target image are set to match the reference image. 3290 This command is related to '-copy-transform' but supports images of 3291 different size. 3292 3293 c3d reference.nii target.nii -mbb -o out.nii""" 3294 3295 def run( 3296 self, 3297 execution: Execution, 3298 ) -> list[str]: 3299 """ 3300 Build command line arguments. This method is called by the main command. 3301 3302 Args: 3303 execution: The execution object. 3304 Returns: 3305 Command line arguments 3306 """ 3307 cargs = [] 3308 cargs.extend([ 3309 "-match-bounding-box", 3310 self.match_bounding_box 3311 ]) 3312 return cargs
-mbb, -match-bounding-box: Match bounding box of one image to another
Syntax: -mbb
Given two images on the stack (reference and target), sets the header of the target image so that the two images occupy the same physical space. The direction cosines of the target image are set to match the reference image. This command is related to '-copy-transform' but supports images of different size.
c3d reference.nii target.nii -mbb -o out.nii.
-mbb, -match-bounding-box: Match bounding box of one image to another
Syntax: -mbb
Given two images on the stack (reference and target), sets the header of the target image so that the two images occupy the same physical space. The direction cosines of the target image are set to match the reference image. This command is related to '-copy-transform' but supports images of different size.
c3d reference.nii target.nii -mbb -o out.nii
3295 def run( 3296 self, 3297 execution: Execution, 3298 ) -> list[str]: 3299 """ 3300 Build command line arguments. This method is called by the main command. 3301 3302 Args: 3303 execution: The execution object. 3304 Returns: 3305 Command line arguments 3306 """ 3307 cargs = [] 3308 cargs.extend([ 3309 "-match-bounding-box", 3310 self.match_bounding_box 3311 ]) 3312 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3739@dataclasses.dataclass 3740class C3dMattesMutualInfo: 3741 """ 3742 No description found. 3743 """ 3744 mattes_mutual_info: str 3745 """No description found.""" 3746 3747 def run( 3748 self, 3749 execution: Execution, 3750 ) -> list[str]: 3751 """ 3752 Build command line arguments. This method is called by the main command. 3753 3754 Args: 3755 execution: The execution object. 3756 Returns: 3757 Command line arguments 3758 """ 3759 cargs = [] 3760 cargs.extend([ 3761 "-mmi", 3762 self.mattes_mutual_info 3763 ]) 3764 return cargs
No description found.
3747 def run( 3748 self, 3749 execution: Execution, 3750 ) -> list[str]: 3751 """ 3752 Build command line arguments. This method is called by the main command. 3753 3754 Args: 3755 execution: The execution object. 3756 Returns: 3757 Command line arguments 3758 """ 3759 cargs = [] 3760 cargs.extend([ 3761 "-mmi", 3762 self.mattes_mutual_info 3763 ]) 3764 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3315@dataclasses.dataclass 3316class C3dMaximum: 3317 """ 3318 -max: Voxel-wise maximum of two images 3319 3320 Syntax: `-max` 3321 3322 Computes the voxel-wise maximum of two images. Can be used with the 3323 **-accum** command to compute maximum of all images. 3324 3325 c3d i1.nii i2.nii -max -o max12.nii 3326 c3d i1.nii i2.nii i3.nii i4.nii -accum -max -endaccum -o max1234.nii. 3327 """ 3328 maximum: str 3329 """-max: Voxel-wise maximum of two images 3330 3331 Syntax: `-max` 3332 3333 Computes the voxel-wise maximum of two images. Can be used with the 3334 **-accum** command to compute maximum of all images. 3335 3336 c3d i1.nii i2.nii -max -o max12.nii 3337 c3d i1.nii i2.nii i3.nii i4.nii -accum -max -endaccum -o max1234.nii""" 3338 3339 def run( 3340 self, 3341 execution: Execution, 3342 ) -> list[str]: 3343 """ 3344 Build command line arguments. This method is called by the main command. 3345 3346 Args: 3347 execution: The execution object. 3348 Returns: 3349 Command line arguments 3350 """ 3351 cargs = [] 3352 cargs.extend([ 3353 "-maximum", 3354 self.maximum 3355 ]) 3356 return cargs
-max: Voxel-wise maximum of two images
Syntax: -max
Computes the voxel-wise maximum of two images. Can be used with the -accum command to compute maximum of all images.
c3d i1.nii i2.nii -max -o max12.nii c3d i1.nii i2.nii i3.nii i4.nii -accum -max -endaccum -o max1234.nii.
-max: Voxel-wise maximum of two images
Syntax: -max
Computes the voxel-wise maximum of two images. Can be used with the -accum command to compute maximum of all images.
c3d i1.nii i2.nii -max -o max12.nii c3d i1.nii i2.nii i3.nii i4.nii -accum -max -endaccum -o max1234.nii
3339 def run( 3340 self, 3341 execution: Execution, 3342 ) -> list[str]: 3343 """ 3344 Build command line arguments. This method is called by the main command. 3345 3346 Args: 3347 execution: The execution object. 3348 Returns: 3349 Command line arguments 3350 """ 3351 cargs = [] 3352 cargs.extend([ 3353 "-maximum", 3354 self.maximum 3355 ]) 3356 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3421@dataclasses.dataclass 3422class C3dMean: 3423 """ 3424 -mean: Mean of all images on the stack 3425 3426 Syntax: `-mean ` 3427 3428 Computes the mean of all the images on the stack. All images on the stack 3429 are replaced with the mean image. 3430 3431 c3d image_*.nii -mean -o mean.nii. 3432 """ 3433 mean: str 3434 """-mean: Mean of all images on the stack 3435 3436 Syntax: `-mean ` 3437 3438 Computes the mean of all the images on the stack. All images on the stack 3439 are replaced with the mean image. 3440 3441 c3d image_*.nii -mean -o mean.nii""" 3442 3443 def run( 3444 self, 3445 execution: Execution, 3446 ) -> list[str]: 3447 """ 3448 Build command line arguments. This method is called by the main command. 3449 3450 Args: 3451 execution: The execution object. 3452 Returns: 3453 Command line arguments 3454 """ 3455 cargs = [] 3456 cargs.extend([ 3457 "-mean", 3458 self.mean 3459 ]) 3460 return cargs
-mean: Mean of all images on the stack
Syntax: -mean
Computes the mean of all the images on the stack. All images on the stack are replaced with the mean image.
c3d image_*.nii -mean -o mean.nii.
-mean: Mean of all images on the stack
Syntax: -mean
Computes the mean of all the images on the stack. All images on the stack are replaced with the mean image.
c3d image_*.nii -mean -o mean.nii
3443 def run( 3444 self, 3445 execution: Execution, 3446 ) -> list[str]: 3447 """ 3448 Build command line arguments. This method is called by the main command. 3449 3450 Args: 3451 execution: The execution object. 3452 Returns: 3453 Command line arguments 3454 """ 3455 cargs = [] 3456 cargs.extend([ 3457 "-mean", 3458 self.mean 3459 ]) 3460 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3549@dataclasses.dataclass 3550class C3dMeanFilter: 3551 """ 3552 -mf, -mean-filter: Mean filter 3553 3554 Syntax: `-mf <radius_vector>` 3555 3556 Applies the mean filter: the intensity of each voxel is replaced by the mean 3557 of the intensities in the neighborhood of size specified by the radius 3558 parameter. For example, the following code will apply the mean filter with 3559 the 5x5x5 neighborhood. 3560 3561 c3d in.nii -mf 2x2x2 -o filtered.nii. 3562 """ 3563 mean_filter: str 3564 """-mf, -mean-filter: Mean filter 3565 3566 Syntax: `-mf <radius_vector>` 3567 3568 Applies the mean filter: the intensity of each voxel is replaced by the mean 3569 of the intensities in the neighborhood of size specified by the radius 3570 parameter. For example, the following code will apply the mean filter with 3571 the 5x5x5 neighborhood. 3572 3573 c3d in.nii -mf 2x2x2 -o filtered.nii""" 3574 3575 def run( 3576 self, 3577 execution: Execution, 3578 ) -> list[str]: 3579 """ 3580 Build command line arguments. This method is called by the main command. 3581 3582 Args: 3583 execution: The execution object. 3584 Returns: 3585 Command line arguments 3586 """ 3587 cargs = [] 3588 cargs.extend([ 3589 "-mf", 3590 self.mean_filter 3591 ]) 3592 return cargs
-mf, -mean-filter: Mean filter
Syntax: -mf <radius_vector>
Applies the mean filter: the intensity of each voxel is replaced by the mean of the intensities in the neighborhood of size specified by the radius parameter. For example, the following code will apply the mean filter with the 5x5x5 neighborhood.
c3d in.nii -mf 2x2x2 -o filtered.nii.
-mf, -mean-filter: Mean filter
Syntax: -mf <radius_vector>
Applies the mean filter: the intensity of each voxel is replaced by the mean of the intensities in the neighborhood of size specified by the radius parameter. For example, the following code will apply the mean filter with the 5x5x5 neighborhood.
c3d in.nii -mf 2x2x2 -o filtered.nii
3575 def run( 3576 self, 3577 execution: Execution, 3578 ) -> list[str]: 3579 """ 3580 Build command line arguments. This method is called by the main command. 3581 3582 Args: 3583 execution: The execution object. 3584 Returns: 3585 Command line arguments 3586 """ 3587 cargs = [] 3588 cargs.extend([ 3589 "-mf", 3590 self.mean_filter 3591 ]) 3592 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3767@dataclasses.dataclass 3768class C3dMeanSquare: 3769 """ 3770 -msq, -mean-square: Compute mean square difference metric 3771 3772 Syntax: `-msq [movtransform.mat] [reftransform.mat]` 3773 3774 Compute the mean square difference metric between the last two images on the 3775 stack. If an optional *movtransform.mat* file is provided, the metric is 3776 computed by applying the transform to the moving image. If, in addition to 3777 *movtransform.mat*, the optional *reftransform.mat* file is also provided -- 3778 the moving transform is applied to the moving image, the ref transform is 3779 applied to the reference image, and the metric is computed in an image space 3780 that is physically halfway between the reference and moving images. This may 3781 be useful for unbiased metric computation if the two transforms are inverse 3782 of each other as both images undergo similar amount of interpolation. The 3783 definitions of reference and moving images and the transform file format are 3784 similar to the **-reslice-matrix** command. 3785 3786 # Compute metric between ref.nii and mov.nii 3787 c3d ref.nii mov.nii -msq 3788 3789 # Compute metric between ref.nii and mov.nii after applying transform to 3790 mov.nii 3791 c3d ref.nii mov.nii -msq tmov.mat 3792 3793 # Compute metric between ref.nii and mov.nii in a neutral space after 3794 applying transforms to both 3795 c3d ref.nii mov.nii -msq tmov.mat tref.mat. 3796 """ 3797 mean_square: str 3798 """-msq, -mean-square: Compute mean square difference metric 3799 3800 Syntax: `-msq [movtransform.mat] [reftransform.mat]` 3801 3802 Compute the mean square difference metric between the last two images on the 3803 stack. If an optional *movtransform.mat* file is provided, the metric is 3804 computed by applying the transform to the moving image. If, in addition to 3805 *movtransform.mat*, the optional *reftransform.mat* file is also provided -- 3806 the moving transform is applied to the moving image, the ref transform is 3807 applied to the reference image, and the metric is computed in an image space 3808 that is physically halfway between the reference and moving images. This may 3809 be useful for unbiased metric computation if the two transforms are inverse 3810 of each other as both images undergo similar amount of interpolation. The 3811 definitions of reference and moving images and the transform file format are 3812 similar to the **-reslice-matrix** command. 3813 3814 # Compute metric between ref.nii and mov.nii 3815 c3d ref.nii mov.nii -msq 3816 3817 # Compute metric between ref.nii and mov.nii after applying transform to 3818 mov.nii 3819 c3d ref.nii mov.nii -msq tmov.mat 3820 3821 # Compute metric between ref.nii and mov.nii in a neutral space after 3822 applying transforms to both 3823 c3d ref.nii mov.nii -msq tmov.mat tref.mat""" 3824 3825 def run( 3826 self, 3827 execution: Execution, 3828 ) -> list[str]: 3829 """ 3830 Build command line arguments. This method is called by the main command. 3831 3832 Args: 3833 execution: The execution object. 3834 Returns: 3835 Command line arguments 3836 """ 3837 cargs = [] 3838 cargs.extend([ 3839 "-msq", 3840 self.mean_square 3841 ]) 3842 return cargs
-msq, -mean-square: Compute mean square difference metric
Syntax: -msq [movtransform.mat] [reftransform.mat]
Compute the mean square difference metric between the last two images on the stack. If an optional movtransform.mat file is provided, the metric is computed by applying the transform to the moving image. If, in addition to movtransform.mat, the optional reftransform.mat file is also provided -- the moving transform is applied to the moving image, the ref transform is applied to the reference image, and the metric is computed in an image space that is physically halfway between the reference and moving images. This may be useful for unbiased metric computation if the two transforms are inverse of each other as both images undergo similar amount of interpolation. The definitions of reference and moving images and the transform file format are similar to the -reslice-matrix command.
Compute metric between ref.nii and mov.nii
c3d ref.nii mov.nii -msq
Compute metric between ref.nii and mov.nii after applying transform to
mov.nii c3d ref.nii mov.nii -msq tmov.mat
Compute metric between ref.nii and mov.nii in a neutral space after
applying transforms to both c3d ref.nii mov.nii -msq tmov.mat tref.mat.
-msq, -mean-square: Compute mean square difference metric
Syntax: -msq [movtransform.mat] [reftransform.mat]
Compute the mean square difference metric between the last two images on the stack. If an optional movtransform.mat file is provided, the metric is computed by applying the transform to the moving image. If, in addition to movtransform.mat, the optional reftransform.mat file is also provided -- the moving transform is applied to the moving image, the ref transform is applied to the reference image, and the metric is computed in an image space that is physically halfway between the reference and moving images. This may be useful for unbiased metric computation if the two transforms are inverse of each other as both images undergo similar amount of interpolation. The definitions of reference and moving images and the transform file format are similar to the -reslice-matrix command.
Compute metric between ref.nii and mov.nii
c3d ref.nii mov.nii -msq
Compute metric between ref.nii and mov.nii after applying transform to
mov.nii c3d ref.nii mov.nii -msq tmov.mat
Compute metric between ref.nii and mov.nii in a neutral space after
applying transforms to both c3d ref.nii mov.nii -msq tmov.mat tref.mat
3825 def run( 3826 self, 3827 execution: Execution, 3828 ) -> list[str]: 3829 """ 3830 Build command line arguments. This method is called by the main command. 3831 3832 Args: 3833 execution: The execution object. 3834 Returns: 3835 Command line arguments 3836 """ 3837 cargs = [] 3838 cargs.extend([ 3839 "-msq", 3840 self.mean_square 3841 ]) 3842 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3463@dataclasses.dataclass 3464class C3dMedianFilter: 3465 """ 3466 -median, -median-filter: Median filter 3467 3468 Syntax: `-median <radius_vector>` 3469 3470 Applies the median filter: the intensity of each voxel is replaced by the 3471 median of the intensities in the neighborhood of size specified by the 3472 radius parameter. For example, the following code will apply the median 3473 filter with the 5x5x5 neighborhood. 3474 3475 c3d in.nii -median 2x2x2 -o median.nii. 3476 """ 3477 median_filter: str 3478 """-median, -median-filter: Median filter 3479 3480 Syntax: `-median <radius_vector>` 3481 3482 Applies the median filter: the intensity of each voxel is replaced by the 3483 median of the intensities in the neighborhood of size specified by the 3484 radius parameter. For example, the following code will apply the median 3485 filter with the 5x5x5 neighborhood. 3486 3487 c3d in.nii -median 2x2x2 -o median.nii""" 3488 3489 def run( 3490 self, 3491 execution: Execution, 3492 ) -> list[str]: 3493 """ 3494 Build command line arguments. This method is called by the main command. 3495 3496 Args: 3497 execution: The execution object. 3498 Returns: 3499 Command line arguments 3500 """ 3501 cargs = [] 3502 cargs.extend([ 3503 "-median", 3504 self.median_filter 3505 ]) 3506 return cargs
-median, -median-filter: Median filter
Syntax: -median <radius_vector>
Applies the median filter: the intensity of each voxel is replaced by the median of the intensities in the neighborhood of size specified by the radius parameter. For example, the following code will apply the median filter with the 5x5x5 neighborhood.
c3d in.nii -median 2x2x2 -o median.nii.
-median, -median-filter: Median filter
Syntax: -median <radius_vector>
Applies the median filter: the intensity of each voxel is replaced by the median of the intensities in the neighborhood of size specified by the radius parameter. For example, the following code will apply the median filter with the 5x5x5 neighborhood.
c3d in.nii -median 2x2x2 -o median.nii
3489 def run( 3490 self, 3491 execution: Execution, 3492 ) -> list[str]: 3493 """ 3494 Build command line arguments. This method is called by the main command. 3495 3496 Args: 3497 execution: The execution object. 3498 Returns: 3499 Command line arguments 3500 """ 3501 cargs = [] 3502 cargs.extend([ 3503 "-median", 3504 self.median_filter 3505 ]) 3506 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3509@dataclasses.dataclass 3510class C3dMerge: 3511 """ 3512 -merge: Merge images from previous split command 3513 3514 Syntax: `-merge` 3515 3516 Works in conjunction with the **-split** command. Has similar behavior to 3517 **-vote**, except that label values are carried from the input to the 3518 **-split** command. 3519 """ 3520 merge: str 3521 """-merge: Merge images from previous split command 3522 3523 Syntax: `-merge` 3524 3525 Works in conjunction with the **-split** command. Has similar behavior to 3526 **-vote**, except that label values are carried from the input to the 3527 **-split** command.""" 3528 3529 def run( 3530 self, 3531 execution: Execution, 3532 ) -> list[str]: 3533 """ 3534 Build command line arguments. This method is called by the main command. 3535 3536 Args: 3537 execution: The execution object. 3538 Returns: 3539 Command line arguments 3540 """ 3541 cargs = [] 3542 cargs.extend([ 3543 "-merge", 3544 self.merge 3545 ]) 3546 return cargs
-merge: Merge images from previous split command
Syntax: -merge
Works in conjunction with the -split command. Has similar behavior to -vote, except that label values are carried from the input to the -split command.
-merge: Merge images from previous split command
Syntax: -merge
Works in conjunction with the -split command. Has similar behavior to -vote, except that label values are carried from the input to the -split command.
3529 def run( 3530 self, 3531 execution: Execution, 3532 ) -> list[str]: 3533 """ 3534 Build command line arguments. This method is called by the main command. 3535 3536 Args: 3537 execution: The execution object. 3538 Returns: 3539 Command line arguments 3540 """ 3541 cargs = [] 3542 cargs.extend([ 3543 "-merge", 3544 self.merge 3545 ]) 3546 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3639@dataclasses.dataclass 3640class C3dMinimum: 3641 """ 3642 -min: Voxel-wise minimum of two images 3643 3644 Syntax: `-min` 3645 3646 Computes the voxel-wise minimum of two images. Can be used with the 3647 **-accum** command to compute minimum of all images. 3648 3649 c3d i1.nii i2.nii -min -o min12.nii 3650 c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii. 3651 """ 3652 minimum: str 3653 """-min: Voxel-wise minimum of two images 3654 3655 Syntax: `-min` 3656 3657 Computes the voxel-wise minimum of two images. Can be used with the 3658 **-accum** command to compute minimum of all images. 3659 3660 c3d i1.nii i2.nii -min -o min12.nii 3661 c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii""" 3662 3663 def run( 3664 self, 3665 execution: Execution, 3666 ) -> list[str]: 3667 """ 3668 Build command line arguments. This method is called by the main command. 3669 3670 Args: 3671 execution: The execution object. 3672 Returns: 3673 Command line arguments 3674 """ 3675 cargs = [] 3676 cargs.extend([ 3677 "-minimum", 3678 self.minimum 3679 ]) 3680 return cargs
-min: Voxel-wise minimum of two images
Syntax: -min
Computes the voxel-wise minimum of two images. Can be used with the -accum command to compute minimum of all images.
c3d i1.nii i2.nii -min -o min12.nii c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii.
-min: Voxel-wise minimum of two images
Syntax: -min
Computes the voxel-wise minimum of two images. Can be used with the -accum command to compute minimum of all images.
c3d i1.nii i2.nii -min -o min12.nii c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii
3663 def run( 3664 self, 3665 execution: Execution, 3666 ) -> list[str]: 3667 """ 3668 Build command line arguments. This method is called by the main command. 3669 3670 Args: 3671 execution: The execution object. 3672 Returns: 3673 Command line arguments 3674 """ 3675 cargs = [] 3676 cargs.extend([ 3677 "-minimum", 3678 self.minimum 3679 ]) 3680 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3683@dataclasses.dataclass 3684class C3dMixtureModel: 3685 """ 3686 No description found. 3687 """ 3688 mixture_model: str 3689 """No description found.""" 3690 3691 def run( 3692 self, 3693 execution: Execution, 3694 ) -> list[str]: 3695 """ 3696 Build command line arguments. This method is called by the main command. 3697 3698 Args: 3699 execution: The execution object. 3700 Returns: 3701 Command line arguments 3702 """ 3703 cargs = [] 3704 cargs.extend([ 3705 "-mixture", 3706 self.mixture_model 3707 ]) 3708 return cargs
No description found.
3691 def run( 3692 self, 3693 execution: Execution, 3694 ) -> list[str]: 3695 """ 3696 Build command line arguments. This method is called by the main command. 3697 3698 Args: 3699 execution: The execution object. 3700 Returns: 3701 Command line arguments 3702 """ 3703 cargs = [] 3704 cargs.extend([ 3705 "-mixture", 3706 self.mixture_model 3707 ]) 3708 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3711@dataclasses.dataclass 3712class C3dMoments: 3713 """ 3714 No description found. 3715 """ 3716 moments: str 3717 """No description found.""" 3718 3719 def run( 3720 self, 3721 execution: Execution, 3722 ) -> list[str]: 3723 """ 3724 Build command line arguments. This method is called by the main command. 3725 3726 Args: 3727 execution: The execution object. 3728 Returns: 3729 Command line arguments 3730 """ 3731 cargs = [] 3732 cargs.extend([ 3733 "-moments", 3734 self.moments 3735 ]) 3736 return cargs
No description found.
3719 def run( 3720 self, 3721 execution: Execution, 3722 ) -> list[str]: 3723 """ 3724 Build command line arguments. This method is called by the main command. 3725 3726 Args: 3727 execution: The execution object. 3728 Returns: 3729 Command line arguments 3730 """ 3731 cargs = [] 3732 cargs.extend([ 3733 "-moments", 3734 self.moments 3735 ]) 3736 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3359@dataclasses.dataclass 3360class C3dMulticomponentSplit: 3361 """ 3362 -mcs, -multicomponent-split: Enable splitting of multi-component images on 3363 read 3364 3365 Syntax: `-mcs` 3366 3367 Enable reading of multi-component images. By default, when a multi-component 3368 image is encountered, the components are combined into a single image. 3369 Setting the **-mcs** flag changes this behavior, and each of the components 3370 is loaded sequentially. See the section below on multi-component image 3371 support. 3372 3373 $ c3d -mcs rgb.mha -foreach -probe 110x110x80mm -endfor 3374 Interpolated image value at 110 110 80 is 1 3375 Interpolated image value at 110 110 80 is 66 3376 Interpolated image value at 110 110 80 is 29 3377 3378 $ c3d rgb.mha -foreach -probe 110x110x80mm -endfor 3379 Interpolated image value at 110 110 80 is 49.5198. 3380 """ 3381 multicomponent_split: str 3382 """-mcs, -multicomponent-split: Enable splitting of multi-component images 3383 on read 3384 3385 Syntax: `-mcs` 3386 3387 Enable reading of multi-component images. By default, when a multi-component 3388 image is encountered, the components are combined into a single image. 3389 Setting the **-mcs** flag changes this behavior, and each of the components 3390 is loaded sequentially. See the section below on multi-component image 3391 support. 3392 3393 $ c3d -mcs rgb.mha -foreach -probe 110x110x80mm -endfor 3394 Interpolated image value at 110 110 80 is 1 3395 Interpolated image value at 110 110 80 is 66 3396 Interpolated image value at 110 110 80 is 29 3397 3398 $ c3d rgb.mha -foreach -probe 110x110x80mm -endfor 3399 Interpolated image value at 110 110 80 is 49.5198""" 3400 3401 def run( 3402 self, 3403 execution: Execution, 3404 ) -> list[str]: 3405 """ 3406 Build command line arguments. This method is called by the main command. 3407 3408 Args: 3409 execution: The execution object. 3410 Returns: 3411 Command line arguments 3412 """ 3413 cargs = [] 3414 cargs.extend([ 3415 "-mcs", 3416 self.multicomponent_split 3417 ]) 3418 return cargs
-mcs, -multicomponent-split: Enable splitting of multi-component images on read
Syntax: -mcs
Enable reading of multi-component images. By default, when a multi-component image is encountered, the components are combined into a single image. Setting the -mcs flag changes this behavior, and each of the components is loaded sequentially. See the section below on multi-component image support.
$ c3d -mcs rgb.mha -foreach -probe 110x110x80mm -endfor Interpolated image value at 110 110 80 is 1 Interpolated image value at 110 110 80 is 66 Interpolated image value at 110 110 80 is 29
$ c3d rgb.mha -foreach -probe 110x110x80mm -endfor Interpolated image value at 110 110 80 is 49.5198.
-mcs, -multicomponent-split: Enable splitting of multi-component images on read
Syntax: -mcs
Enable reading of multi-component images. By default, when a multi-component image is encountered, the components are combined into a single image. Setting the -mcs flag changes this behavior, and each of the components is loaded sequentially. See the section below on multi-component image support.
$ c3d -mcs rgb.mha -foreach -probe 110x110x80mm -endfor Interpolated image value at 110 110 80 is 1 Interpolated image value at 110 110 80 is 66 Interpolated image value at 110 110 80 is 29
$ c3d rgb.mha -foreach -probe 110x110x80mm -endfor Interpolated image value at 110 110 80 is 49.5198
3401 def run( 3402 self, 3403 execution: Execution, 3404 ) -> list[str]: 3405 """ 3406 Build command line arguments. This method is called by the main command. 3407 3408 Args: 3409 execution: The execution object. 3410 Returns: 3411 Command line arguments 3412 """ 3413 cargs = [] 3414 cargs.extend([ 3415 "-mcs", 3416 self.multicomponent_split 3417 ]) 3418 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3845@dataclasses.dataclass 3846class C3dMultiply: 3847 """ 3848 -multiply, -times: Multiply two images 3849 3850 Syntax: `-multiply` 3851 3852 Multiply two images voxel-by-voxel. The operation is applied to the last two 3853 images on the stack. 3854 3855 # Compute x = a * b 3856 c3d a.img b.img -multiply -o x.img 3857 3858 # Compute x = a * (b + c) using add and -multiply 3859 c3d a.img b.img c.img -multiply -add -o x.img 3860 3861 Combine with the **-dup** command to compute voxelwise square of the image 3862 3863 # Compute x = a^2 3864 c3d a.img -dup -multiply -o x.img. 3865 """ 3866 multiply: str 3867 """-multiply, -times: Multiply two images 3868 3869 Syntax: `-multiply` 3870 3871 Multiply two images voxel-by-voxel. The operation is applied to the last two 3872 images on the stack. 3873 3874 # Compute x = a * b 3875 c3d a.img b.img -multiply -o x.img 3876 3877 # Compute x = a * (b + c) using add and -multiply 3878 c3d a.img b.img c.img -multiply -add -o x.img 3879 3880 Combine with the **-dup** command to compute voxelwise square of the image 3881 3882 # Compute x = a^2 3883 c3d a.img -dup -multiply -o x.img""" 3884 3885 def run( 3886 self, 3887 execution: Execution, 3888 ) -> list[str]: 3889 """ 3890 Build command line arguments. This method is called by the main command. 3891 3892 Args: 3893 execution: The execution object. 3894 Returns: 3895 Command line arguments 3896 """ 3897 cargs = [] 3898 cargs.extend([ 3899 "-multiply", 3900 self.multiply 3901 ]) 3902 return cargs
-multiply, -times: Multiply two images
Syntax: -multiply
Multiply two images voxel-by-voxel. The operation is applied to the last two images on the stack.
Compute x = a * b
c3d a.img b.img -multiply -o x.img
Compute x = a * (b + c) using add and -multiply
c3d a.img b.img c.img -multiply -add -o x.img
Combine with the -dup command to compute voxelwise square of the image
Compute x = a^2
c3d a.img -dup -multiply -o x.img.
-multiply, -times: Multiply two images
Syntax: -multiply
Multiply two images voxel-by-voxel. The operation is applied to the last two images on the stack.
Compute x = a * b
c3d a.img b.img -multiply -o x.img
Compute x = a * (b + c) using add and -multiply
c3d a.img b.img c.img -multiply -add -o x.img
Combine with the -dup command to compute voxelwise square of the image
Compute x = a^2
c3d a.img -dup -multiply -o x.img
3885 def run( 3886 self, 3887 execution: Execution, 3888 ) -> list[str]: 3889 """ 3890 Build command line arguments. This method is called by the main command. 3891 3892 Args: 3893 execution: The execution object. 3894 Returns: 3895 Command line arguments 3896 """ 3897 cargs = [] 3898 cargs.extend([ 3899 "-multiply", 3900 self.multiply 3901 ]) 3902 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3595@dataclasses.dataclass 3596class C3dMutualInfo: 3597 """ 3598 -min: Voxel-wise minimum of two images 3599 3600 Syntax: `-min` 3601 3602 Computes the voxel-wise minimum of two images. Can be used with the 3603 **-accum** command to compute minimum of all images. 3604 3605 c3d i1.nii i2.nii -min -o min12.nii 3606 c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii. 3607 """ 3608 mutual_info: str 3609 """-min: Voxel-wise minimum of two images 3610 3611 Syntax: `-min` 3612 3613 Computes the voxel-wise minimum of two images. Can be used with the 3614 **-accum** command to compute minimum of all images. 3615 3616 c3d i1.nii i2.nii -min -o min12.nii 3617 c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii""" 3618 3619 def run( 3620 self, 3621 execution: Execution, 3622 ) -> list[str]: 3623 """ 3624 Build command line arguments. This method is called by the main command. 3625 3626 Args: 3627 execution: The execution object. 3628 Returns: 3629 Command line arguments 3630 """ 3631 cargs = [] 3632 cargs.extend([ 3633 "-mi", 3634 self.mutual_info 3635 ]) 3636 return cargs
-min: Voxel-wise minimum of two images
Syntax: -min
Computes the voxel-wise minimum of two images. Can be used with the -accum command to compute minimum of all images.
c3d i1.nii i2.nii -min -o min12.nii c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii.
-min: Voxel-wise minimum of two images
Syntax: -min
Computes the voxel-wise minimum of two images. Can be used with the -accum command to compute minimum of all images.
c3d i1.nii i2.nii -min -o min12.nii c3d i1.nii i2.nii i3.nii i4.nii -accum -min -endaccum -o min1234.nii
3619 def run( 3620 self, 3621 execution: Execution, 3622 ) -> list[str]: 3623 """ 3624 Build command line arguments. This method is called by the main command. 3625 3626 Args: 3627 execution: The execution object. 3628 Returns: 3629 Command line arguments 3630 """ 3631 cargs = [] 3632 cargs.extend([ 3633 "-mi", 3634 self.mutual_info 3635 ]) 3636 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
466@dataclasses.dataclass 467class C3dN4BiasCorrection: 468 """ 469 -biascorr: Automatic MRI bias field correction 470 471 Syntax: `-biascorr` 472 473 Performs automatic bias field correction for MRI images. This feature uses 474 the [N3 implementation in ITK by Dr. Tustison][4], based on the N3 algorithm 475 by Sled et al. 476 477 c3d mri.nii.gz -biascorr -o mricorr.nii.gz. 478 """ 479 n4_bias_correction: str 480 """-biascorr: Automatic MRI bias field correction 481 482 Syntax: `-biascorr` 483 484 Performs automatic bias field correction for MRI images. This feature uses 485 the [N3 implementation in ITK by Dr. Tustison][4], based on the N3 algorithm 486 by Sled et al. 487 488 c3d mri.nii.gz -biascorr -o mricorr.nii.gz""" 489 490 def run( 491 self, 492 execution: Execution, 493 ) -> list[str]: 494 """ 495 Build command line arguments. This method is called by the main command. 496 497 Args: 498 execution: The execution object. 499 Returns: 500 Command line arguments 501 """ 502 cargs = [] 503 cargs.extend([ 504 "-biascorr", 505 self.n4_bias_correction 506 ]) 507 return cargs
-biascorr: Automatic MRI bias field correction
Syntax: -biascorr
Performs automatic bias field correction for MRI images. This feature uses the [N3 implementation in ITK by Dr. Tustison][4], based on the N3 algorithm by Sled et al.
c3d mri.nii.gz -biascorr -o mricorr.nii.gz.
-biascorr: Automatic MRI bias field correction
Syntax: -biascorr
Performs automatic bias field correction for MRI images. This feature uses the [N3 implementation in ITK by Dr. Tustison][4], based on the N3 algorithm by Sled et al.
c3d mri.nii.gz -biascorr -o mricorr.nii.gz
490 def run( 491 self, 492 execution: Execution, 493 ) -> list[str]: 494 """ 495 Build command line arguments. This method is called by the main command. 496 497 Args: 498 execution: The execution object. 499 Returns: 500 Command line arguments 501 """ 502 cargs = [] 503 cargs.extend([ 504 "-biascorr", 505 self.n4_bias_correction 506 ]) 507 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
1008@dataclasses.dataclass 1009class C3dNoCompress: 1010 """ 1011 -compress, -no-compress: Enable/disable compression for some image files 1012 1013 Syntax: `-compress` or `-no-compress` 1014 1015 Turns on compressing for image file formats that support it. For some file 1016 formats, like NIFTI (.nii), compression is enabled automatically when the 1017 filename includes the **.gz** extension. For other formats, like MetaImage, 1018 you need to specify **-compress** to enable compression. The following two 1019 commands save the image as compressed NIFTI and MetaImage files: 1020 1021 c3d input.nii -o output.nii.gz 1022 c3d input.nii -compress -o output.mha. 1023 """ 1024 no_compress: str 1025 """-compress, -no-compress: Enable/disable compression for some image files 1026 1027 Syntax: `-compress` or `-no-compress` 1028 1029 Turns on compressing for image file formats that support it. For some file 1030 formats, like NIFTI (.nii), compression is enabled automatically when the 1031 filename includes the **.gz** extension. For other formats, like MetaImage, 1032 you need to specify **-compress** to enable compression. The following two 1033 commands save the image as compressed NIFTI and MetaImage files: 1034 1035 c3d input.nii -o output.nii.gz 1036 c3d input.nii -compress -o output.mha""" 1037 1038 def run( 1039 self, 1040 execution: Execution, 1041 ) -> list[str]: 1042 """ 1043 Build command line arguments. This method is called by the main command. 1044 1045 Args: 1046 execution: The execution object. 1047 Returns: 1048 Command line arguments 1049 """ 1050 cargs = [] 1051 cargs.extend([ 1052 "-no-compress", 1053 self.no_compress 1054 ]) 1055 return cargs
-compress, -no-compress: Enable/disable compression for some image files
Syntax: -compress or -no-compress
Turns on compressing for image file formats that support it. For some file formats, like NIFTI (.nii), compression is enabled automatically when the filename includes the .gz extension. For other formats, like MetaImage, you need to specify -compress to enable compression. The following two commands save the image as compressed NIFTI and MetaImage files:
c3d input.nii -o output.nii.gz c3d input.nii -compress -o output.mha.
-compress, -no-compress: Enable/disable compression for some image files
Syntax: -compress or -no-compress
Turns on compressing for image file formats that support it. For some file formats, like NIFTI (.nii), compression is enabled automatically when the filename includes the .gz extension. For other formats, like MetaImage, you need to specify -compress to enable compression. The following two commands save the image as compressed NIFTI and MetaImage files:
c3d input.nii -o output.nii.gz c3d input.nii -compress -o output.mha
1038 def run( 1039 self, 1040 execution: Execution, 1041 ) -> list[str]: 1042 """ 1043 Build command line arguments. This method is called by the main command. 1044 1045 Args: 1046 execution: The execution object. 1047 Returns: 1048 Command line arguments 1049 """ 1050 cargs = [] 1051 cargs.extend([ 1052 "-no-compress", 1053 self.no_compress 1054 ]) 1055 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4189@dataclasses.dataclass 4190class C3dNoMulticomponentSplit: 4191 """ 4192 -nomcs, -no-multicomponent-split: Disable splitting of multi-component 4193 images on read 4194 4195 Syntax: `-nomcs` 4196 4197 Used to reverse the effect of previous **-mcs** command. 4198 """ 4199 no_multicomponent_split: str 4200 """-nomcs, -no-multicomponent-split: Disable splitting of multi-component 4201 images on read 4202 4203 Syntax: `-nomcs` 4204 4205 Used to reverse the effect of previous **-mcs** command.""" 4206 4207 def run( 4208 self, 4209 execution: Execution, 4210 ) -> list[str]: 4211 """ 4212 Build command line arguments. This method is called by the main command. 4213 4214 Args: 4215 execution: The execution object. 4216 Returns: 4217 Command line arguments 4218 """ 4219 cargs = [] 4220 cargs.extend([ 4221 "-nomcs", 4222 self.no_multicomponent_split 4223 ]) 4224 return cargs
-nomcs, -no-multicomponent-split: Disable splitting of multi-component images on read
Syntax: -nomcs
Used to reverse the effect of previous -mcs command.
-nomcs, -no-multicomponent-split: Disable splitting of multi-component images on read
Syntax: -nomcs
Used to reverse the effect of previous -mcs command.
4207 def run( 4208 self, 4209 execution: Execution, 4210 ) -> list[str]: 4211 """ 4212 Build command line arguments. This method is called by the main command. 4213 4214 Args: 4215 execution: The execution object. 4216 Returns: 4217 Command line arguments 4218 """ 4219 cargs = [] 4220 cargs.extend([ 4221 "-nomcs", 4222 self.no_multicomponent_split 4223 ]) 4224 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4027@dataclasses.dataclass 4028class C3dNoiseGaussian: 4029 """ 4030 -noise-gaussian, -noise: Apply additive Gaussian noise 4031 4032 Syntax: `-noise-gaussian <sigma>` 4033 4034 Adds Gaussian noise to an image with zero mean and standard deviation sigma. 4035 Please see [Noise simulation article][15] by G. Lehmann for details. 4036 4037 c3d image.nii -noise-gaussian 5 -o noisy.nii. 4038 """ 4039 noise_gaussian: str 4040 """-noise-gaussian, -noise: Apply additive Gaussian noise 4041 4042 Syntax: `-noise-gaussian <sigma>` 4043 4044 Adds Gaussian noise to an image with zero mean and standard deviation sigma. 4045 Please see [Noise simulation article][15] by G. Lehmann for details. 4046 4047 c3d image.nii -noise-gaussian 5 -o noisy.nii""" 4048 4049 def run( 4050 self, 4051 execution: Execution, 4052 ) -> list[str]: 4053 """ 4054 Build command line arguments. This method is called by the main command. 4055 4056 Args: 4057 execution: The execution object. 4058 Returns: 4059 Command line arguments 4060 """ 4061 cargs = [] 4062 cargs.extend([ 4063 "-noise-gaussian", 4064 self.noise_gaussian 4065 ]) 4066 return cargs
-noise-gaussian, -noise: Apply additive Gaussian noise
Syntax: -noise-gaussian <sigma>
Adds Gaussian noise to an image with zero mean and standard deviation sigma. Please see [Noise simulation article][15] by G. Lehmann for details.
c3d image.nii -noise-gaussian 5 -o noisy.nii.
-noise-gaussian, -noise: Apply additive Gaussian noise
Syntax: -noise-gaussian <sigma>
Adds Gaussian noise to an image with zero mean and standard deviation sigma. Please see [Noise simulation article][15] by G. Lehmann for details.
c3d image.nii -noise-gaussian 5 -o noisy.nii
4049 def run( 4050 self, 4051 execution: Execution, 4052 ) -> list[str]: 4053 """ 4054 Build command line arguments. This method is called by the main command. 4055 4056 Args: 4057 execution: The execution object. 4058 Returns: 4059 Command line arguments 4060 """ 4061 cargs = [] 4062 cargs.extend([ 4063 "-noise-gaussian", 4064 self.noise_gaussian 4065 ]) 4066 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4069@dataclasses.dataclass 4070class C3dNoisePoisson: 4071 """ 4072 -noise-poisson: Apply Poisson noise 4073 Syntax: `-noise-poisson <scale>` 4074 4075 Applies Poisson (shot) noise to an image with given scale. Please see [Noise 4076 simulation article][15] by G. Lehmann for details. 4077 4078 c3d image.nii -noise-poisson 5 -o noisy.nii. 4079 """ 4080 noise_poisson: str 4081 """-noise-poisson: Apply Poisson noise 4082 Syntax: `-noise-poisson <scale>` 4083 4084 Applies Poisson (shot) noise to an image with given scale. Please see [Noise 4085 simulation article][15] by G. Lehmann for details. 4086 4087 c3d image.nii -noise-poisson 5 -o noisy.nii""" 4088 4089 def run( 4090 self, 4091 execution: Execution, 4092 ) -> list[str]: 4093 """ 4094 Build command line arguments. This method is called by the main command. 4095 4096 Args: 4097 execution: The execution object. 4098 Returns: 4099 Command line arguments 4100 """ 4101 cargs = [] 4102 cargs.extend([ 4103 "-noise-poisson", 4104 self.noise_poisson 4105 ]) 4106 return cargs
-noise-poisson: Apply Poisson noise
Syntax: -noise-poisson <scale>
Applies Poisson (shot) noise to an image with given scale. Please see [Noise simulation article][15] by G. Lehmann for details.
c3d image.nii -noise-poisson 5 -o noisy.nii.
-noise-poisson: Apply Poisson noise
Syntax: -noise-poisson <scale>
Applies Poisson (shot) noise to an image with given scale. Please see [Noise simulation article][15] by G. Lehmann for details.
c3d image.nii -noise-poisson 5 -o noisy.nii
4089 def run( 4090 self, 4091 execution: Execution, 4092 ) -> list[str]: 4093 """ 4094 Build command line arguments. This method is called by the main command. 4095 4096 Args: 4097 execution: The execution object. 4098 Returns: 4099 Command line arguments 4100 """ 4101 cargs = [] 4102 cargs.extend([ 4103 "-noise-poisson", 4104 self.noise_poisson 4105 ]) 4106 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4149@dataclasses.dataclass 4150class C3dNoiseSaltPepper: 4151 """ 4152 -noise-salt-pepper: Apply salt and pepper noise 4153 Syntax: `-noise-salt-pepper <probability>` 4154 4155 Applies salt and pepper noise to an image with given probability. Please see 4156 [Noise simulation article][15] by G. Lehmann for details. 4157 4158 c3d image.nii -noise-salt-pepper 0.1 -o noisy.nii. 4159 """ 4160 noise_salt_pepper: str 4161 """-noise-salt-pepper: Apply salt and pepper noise 4162 Syntax: `-noise-salt-pepper <probability>` 4163 4164 Applies salt and pepper noise to an image with given probability. Please see 4165 [Noise simulation article][15] by G. Lehmann for details. 4166 4167 c3d image.nii -noise-salt-pepper 0.1 -o noisy.nii""" 4168 4169 def run( 4170 self, 4171 execution: Execution, 4172 ) -> list[str]: 4173 """ 4174 Build command line arguments. This method is called by the main command. 4175 4176 Args: 4177 execution: The execution object. 4178 Returns: 4179 Command line arguments 4180 """ 4181 cargs = [] 4182 cargs.extend([ 4183 "-noise-salt-pepper", 4184 self.noise_salt_pepper 4185 ]) 4186 return cargs
-noise-salt-pepper: Apply salt and pepper noise
Syntax: -noise-salt-pepper <probability>
Applies salt and pepper noise to an image with given probability. Please see [Noise simulation article][15] by G. Lehmann for details.
c3d image.nii -noise-salt-pepper 0.1 -o noisy.nii.
-noise-salt-pepper: Apply salt and pepper noise
Syntax: -noise-salt-pepper <probability>
Applies salt and pepper noise to an image with given probability. Please see [Noise simulation article][15] by G. Lehmann for details.
c3d image.nii -noise-salt-pepper 0.1 -o noisy.nii
4169 def run( 4170 self, 4171 execution: Execution, 4172 ) -> list[str]: 4173 """ 4174 Build command line arguments. This method is called by the main command. 4175 4176 Args: 4177 execution: The execution object. 4178 Returns: 4179 Command line arguments 4180 """ 4181 cargs = [] 4182 cargs.extend([ 4183 "-noise-salt-pepper", 4184 self.noise_salt_pepper 4185 ]) 4186 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4109@dataclasses.dataclass 4110class C3dNoiseSpeckle: 4111 """ 4112 -noise-speckle: Apply Poisson noise 4113 Syntax: `-noise-speckle <sigma>` 4114 4115 Applies Speckle noise to an image with given standard deviation. Please see 4116 [Noise simulation article][15] by G. Lehmann for details. 4117 4118 c3d image.nii -noise-speckle 5 -o noisy.nii. 4119 """ 4120 noise_speckle: str 4121 """-noise-speckle: Apply Poisson noise 4122 Syntax: `-noise-speckle <sigma>` 4123 4124 Applies Speckle noise to an image with given standard deviation. Please see 4125 [Noise simulation article][15] by G. Lehmann for details. 4126 4127 c3d image.nii -noise-speckle 5 -o noisy.nii""" 4128 4129 def run( 4130 self, 4131 execution: Execution, 4132 ) -> list[str]: 4133 """ 4134 Build command line arguments. This method is called by the main command. 4135 4136 Args: 4137 execution: The execution object. 4138 Returns: 4139 Command line arguments 4140 """ 4141 cargs = [] 4142 cargs.extend([ 4143 "-noise-speckle", 4144 self.noise_speckle 4145 ]) 4146 return cargs
-noise-speckle: Apply Poisson noise
Syntax: -noise-speckle <sigma>
Applies Speckle noise to an image with given standard deviation. Please see [Noise simulation article][15] by G. Lehmann for details.
c3d image.nii -noise-speckle 5 -o noisy.nii.
-noise-speckle: Apply Poisson noise
Syntax: -noise-speckle <sigma>
Applies Speckle noise to an image with given standard deviation. Please see [Noise simulation article][15] by G. Lehmann for details.
c3d image.nii -noise-speckle 5 -o noisy.nii
4129 def run( 4130 self, 4131 execution: Execution, 4132 ) -> list[str]: 4133 """ 4134 Build command line arguments. This method is called by the main command. 4135 4136 Args: 4137 execution: The execution object. 4138 Returns: 4139 Command line arguments 4140 """ 4141 cargs = [] 4142 cargs.extend([ 4143 "-noise-speckle", 4144 self.noise_speckle 4145 ]) 4146 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4227@dataclasses.dataclass 4228class C3dNormalizeLocalWindow: 4229 """ 4230 -nlw, -normalize-local-window: Standardize image intensity using local 4231 neighborhood 4232 4233 Syntax: `-nlw <radius>` 4234 4235 This command takes as inputs an image and a mask image. At each voxel, the 4236 mean of the local neighborhood is subtracted, and the result is divided by 4237 the standard deviation of the neighborhood. The mean and standard deviation 4238 are computed only over the masked region. You might also want to multiply by 4239 the mask. 4240 4241 c3d gray.nii.gz mask.nii.gz -nlw 10x10x10 -o residual.nii.gz. 4242 """ 4243 normalize_local_window: str 4244 """-nlw, -normalize-local-window: Standardize image intensity using local 4245 neighborhood 4246 4247 Syntax: `-nlw <radius>` 4248 4249 This command takes as inputs an image and a mask image. At each voxel, the 4250 mean of the local neighborhood is subtracted, and the result is divided by 4251 the standard deviation of the neighborhood. The mean and standard deviation 4252 are computed only over the masked region. You might also want to multiply by 4253 the mask. 4254 4255 c3d gray.nii.gz mask.nii.gz -nlw 10x10x10 -o residual.nii.gz""" 4256 4257 def run( 4258 self, 4259 execution: Execution, 4260 ) -> list[str]: 4261 """ 4262 Build command line arguments. This method is called by the main command. 4263 4264 Args: 4265 execution: The execution object. 4266 Returns: 4267 Command line arguments 4268 """ 4269 cargs = [] 4270 cargs.extend([ 4271 "-nlw", 4272 self.normalize_local_window 4273 ]) 4274 return cargs
-nlw, -normalize-local-window: Standardize image intensity using local neighborhood
Syntax: -nlw <radius>
This command takes as inputs an image and a mask image. At each voxel, the mean of the local neighborhood is subtracted, and the result is divided by the standard deviation of the neighborhood. The mean and standard deviation are computed only over the masked region. You might also want to multiply by the mask.
c3d gray.nii.gz mask.nii.gz -nlw 10x10x10 -o residual.nii.gz.
-nlw, -normalize-local-window: Standardize image intensity using local neighborhood
Syntax: -nlw <radius>
This command takes as inputs an image and a mask image. At each voxel, the mean of the local neighborhood is subtracted, and the result is divided by the standard deviation of the neighborhood. The mean and standard deviation are computed only over the masked region. You might also want to multiply by the mask.
c3d gray.nii.gz mask.nii.gz -nlw 10x10x10 -o residual.nii.gz
4257 def run( 4258 self, 4259 execution: Execution, 4260 ) -> list[str]: 4261 """ 4262 Build command line arguments. This method is called by the main command. 4263 4264 Args: 4265 execution: The execution object. 4266 Returns: 4267 Command line arguments 4268 """ 4269 cargs = [] 4270 cargs.extend([ 4271 "-nlw", 4272 self.normalize_local_window 4273 ]) 4274 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3951@dataclasses.dataclass 3952class C3dNormalizedCorrelation: 3953 """ 3954 -ncor, -normalized-correlation: Compute normalized correlation metric 3955 3956 Syntax: `-ncor [movtransform.mat] [reftransform.mat]` 3957 3958 : Compute the normalized correlation metric between the last two images on 3959 the stack. See documentation for **-msq***. 3960 """ 3961 normalized_correlation: str 3962 """-ncor, -normalized-correlation: Compute normalized correlation metric 3963 3964 Syntax: `-ncor [movtransform.mat] [reftransform.mat]` 3965 3966 : Compute the normalized correlation metric between the last two images on 3967 the stack. See documentation for **-msq***.""" 3968 3969 def run( 3970 self, 3971 execution: Execution, 3972 ) -> list[str]: 3973 """ 3974 Build command line arguments. This method is called by the main command. 3975 3976 Args: 3977 execution: The execution object. 3978 Returns: 3979 Command line arguments 3980 """ 3981 cargs = [] 3982 cargs.extend([ 3983 "-ncor", 3984 self.normalized_correlation 3985 ]) 3986 return cargs
-ncor, -normalized-correlation: Compute normalized correlation metric
Syntax: -ncor [movtransform.mat] [reftransform.mat]
: Compute the normalized correlation metric between the last two images on the stack. See documentation for -msq*.
-ncor, -normalized-correlation: Compute normalized correlation metric
Syntax: -ncor [movtransform.mat] [reftransform.mat]
: Compute the normalized correlation metric between the last two images on the stack. See documentation for -msq*.
3969 def run( 3970 self, 3971 execution: Execution, 3972 ) -> list[str]: 3973 """ 3974 Build command line arguments. This method is called by the main command. 3975 3976 Args: 3977 execution: The execution object. 3978 Returns: 3979 Command line arguments 3980 """ 3981 cargs = [] 3982 cargs.extend([ 3983 "-ncor", 3984 self.normalized_correlation 3985 ]) 3986 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3905@dataclasses.dataclass 3906class C3dNormalizedCrossCorrelation: 3907 """ 3908 -ncc, -normalized-cross-correlation: Compute normalized cross-correlation 3909 image 3910 3911 Syntax: `-ncc <radius_vector>` 3912 3913 Computes normalized cross-correlation between two images that occupy the 3914 same physical space. Each voxel in the resulting image is the 3915 cross-correlation of patches of given radius surrounding the voxel in the 3916 two input images. This is different from **-ncor**, which computes a global 3917 cross-correlation metric value. 3918 """ 3919 normalized_cross_correlation: str 3920 """-ncc, -normalized-cross-correlation: Compute normalized cross-correlation 3921 image 3922 3923 Syntax: `-ncc <radius_vector>` 3924 3925 Computes normalized cross-correlation between two images that occupy the 3926 same physical space. Each voxel in the resulting image is the 3927 cross-correlation of patches of given radius surrounding the voxel in the 3928 two input images. This is different from **-ncor**, which computes a global 3929 cross-correlation metric value.""" 3930 3931 def run( 3932 self, 3933 execution: Execution, 3934 ) -> list[str]: 3935 """ 3936 Build command line arguments. This method is called by the main command. 3937 3938 Args: 3939 execution: The execution object. 3940 Returns: 3941 Command line arguments 3942 """ 3943 cargs = [] 3944 cargs.extend([ 3945 "-ncc", 3946 self.normalized_cross_correlation 3947 ]) 3948 return cargs
-ncc, -normalized-cross-correlation: Compute normalized cross-correlation image
Syntax: -ncc <radius_vector>
Computes normalized cross-correlation between two images that occupy the same physical space. Each voxel in the resulting image is the cross-correlation of patches of given radius surrounding the voxel in the two input images. This is different from -ncor, which computes a global cross-correlation metric value.
-ncc, -normalized-cross-correlation: Compute normalized cross-correlation image
Syntax: -ncc <radius_vector>
Computes normalized cross-correlation between two images that occupy the same physical space. Each voxel in the resulting image is the cross-correlation of patches of given radius surrounding the voxel in the two input images. This is different from -ncor, which computes a global cross-correlation metric value.
3931 def run( 3932 self, 3933 execution: Execution, 3934 ) -> list[str]: 3935 """ 3936 Build command line arguments. This method is called by the main command. 3937 3938 Args: 3939 execution: The execution object. 3940 Returns: 3941 Command line arguments 3942 """ 3943 cargs = [] 3944 cargs.extend([ 3945 "-ncc", 3946 self.normalized_cross_correlation 3947 ]) 3948 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
3989@dataclasses.dataclass 3990class C3dNormalizedMutualInfo: 3991 """ 3992 -mmi, -mattes-mutual-info: Compute mutual informaiton metric 3993 3994 Syntax: `-nmi [movtransform.mat] [reftransform.mat]` 3995 3996 Compute the Mattes mutual information metric between the last two images on 3997 the stack. See documentation for **-msq**. 3998 """ 3999 normalized_mutual_info: str 4000 """-mmi, -mattes-mutual-info: Compute mutual informaiton metric 4001 4002 Syntax: `-nmi [movtransform.mat] [reftransform.mat]` 4003 4004 Compute the Mattes mutual information metric between the last two images on 4005 the stack. See documentation for **-msq**.""" 4006 4007 def run( 4008 self, 4009 execution: Execution, 4010 ) -> list[str]: 4011 """ 4012 Build command line arguments. This method is called by the main command. 4013 4014 Args: 4015 execution: The execution object. 4016 Returns: 4017 Command line arguments 4018 """ 4019 cargs = [] 4020 cargs.extend([ 4021 "-nmi", 4022 self.normalized_mutual_info 4023 ]) 4024 return cargs
-mmi, -mattes-mutual-info: Compute mutual informaiton metric
Syntax: -nmi [movtransform.mat] [reftransform.mat]
Compute the Mattes mutual information metric between the last two images on the stack. See documentation for -msq.
-mmi, -mattes-mutual-info: Compute mutual informaiton metric
Syntax: -nmi [movtransform.mat] [reftransform.mat]
Compute the Mattes mutual information metric between the last two images on the stack. See documentation for -msq.
4007 def run( 4008 self, 4009 execution: Execution, 4010 ) -> list[str]: 4011 """ 4012 Build command line arguments. This method is called by the main command. 4013 4014 Args: 4015 execution: The execution object. 4016 Returns: 4017 Command line arguments 4018 """ 4019 cargs = [] 4020 cargs.extend([ 4021 "-nmi", 4022 self.normalized_mutual_info 4023 ]) 4024 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4277@dataclasses.dataclass 4278class C3dNormpdf: 4279 """ 4280 No description found. 4281 """ 4282 normpdf: str 4283 """No description found.""" 4284 4285 def run( 4286 self, 4287 execution: Execution, 4288 ) -> list[str]: 4289 """ 4290 Build command line arguments. This method is called by the main command. 4291 4292 Args: 4293 execution: The execution object. 4294 Returns: 4295 Command line arguments 4296 """ 4297 cargs = [] 4298 cargs.extend([ 4299 "-normpdf", 4300 self.normpdf 4301 ]) 4302 return cargs
No description found.
4285 def run( 4286 self, 4287 execution: Execution, 4288 ) -> list[str]: 4289 """ 4290 Build command line arguments. This method is called by the main command. 4291 4292 Args: 4293 execution: The execution object. 4294 Returns: 4295 Command line arguments 4296 """ 4297 cargs = [] 4298 cargs.extend([ 4299 "-normpdf", 4300 self.normpdf 4301 ]) 4302 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4305@dataclasses.dataclass 4306class C3dNoround: 4307 """ 4308 -noround, -round: Floating point rounding behavior 4309 4310 Syntax: `-noround` or `-round ` 4311 4312 By default, **convert3d** will round floating point values when converting 4313 to an integer, short or byte image. This command specifies that rounding 4314 should not be used. Rounding is used to avoid numerical errors stemming from 4315 the internal floating point representation. 4316 4317 c3d image1.img -type short -noround image2.img. 4318 """ 4319 noround: str 4320 """-noround, -round: Floating point rounding behavior 4321 4322 Syntax: `-noround` or `-round ` 4323 4324 By default, **convert3d** will round floating point values when converting 4325 to an integer, short or byte image. This command specifies that rounding 4326 should not be used. Rounding is used to avoid numerical errors stemming from 4327 the internal floating point representation. 4328 4329 c3d image1.img -type short -noround image2.img""" 4330 4331 def run( 4332 self, 4333 execution: Execution, 4334 ) -> list[str]: 4335 """ 4336 Build command line arguments. This method is called by the main command. 4337 4338 Args: 4339 execution: The execution object. 4340 Returns: 4341 Command line arguments 4342 """ 4343 cargs = [] 4344 cargs.extend([ 4345 "-noround", 4346 self.noround 4347 ]) 4348 return cargs
-noround, -round: Floating point rounding behavior
Syntax: -noround or -round
By default, convert3d will round floating point values when converting to an integer, short or byte image. This command specifies that rounding should not be used. Rounding is used to avoid numerical errors stemming from the internal floating point representation.
c3d image1.img -type short -noround image2.img.
-noround, -round: Floating point rounding behavior
Syntax: -noround or -round
By default, convert3d will round floating point values when converting to an integer, short or byte image. This command specifies that rounding should not be used. Rounding is used to avoid numerical errors stemming from the internal floating point representation.
c3d image1.img -type short -noround image2.img
4331 def run( 4332 self, 4333 execution: Execution, 4334 ) -> list[str]: 4335 """ 4336 Build command line arguments. This method is called by the main command. 4337 4338 Args: 4339 execution: The execution object. 4340 Returns: 4341 Command line arguments 4342 """ 4343 cargs = [] 4344 cargs.extend([ 4345 "-noround", 4346 self.noround 4347 ]) 4348 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4351@dataclasses.dataclass 4352class C3dNospm: 4353 """ 4354 -spm, -nospm: SPM compatibility in Analyze output 4355 4356 Syntax: `-spm` or `-nospm ` 4357 4358 These options specify whether use the SPM extension to the Analyze 4359 (.hdr,.img) format. When this option is on, the origin field stored by SPM 4360 in the Analyze header will be correctly interpreted. When saving analyze 4361 files, the origin will be set correctly. The default is equivalent to the 4362 **-nospm** option. Best to avoid this issue altogether by using NIFTI and 4363 SPM5 or later. 4364 4365 c3d -spm in.hdr out.img.gz. 4366 """ 4367 nospm: str 4368 """-spm, -nospm: SPM compatibility in Analyze output 4369 4370 Syntax: `-spm` or `-nospm ` 4371 4372 These options specify whether use the SPM extension to the Analyze 4373 (.hdr,.img) format. When this option is on, the origin field stored by SPM 4374 in the Analyze header will be correctly interpreted. When saving analyze 4375 files, the origin will be set correctly. The default is equivalent to the 4376 **-nospm** option. Best to avoid this issue altogether by using NIFTI and 4377 SPM5 or later. 4378 4379 c3d -spm in.hdr out.img.gz""" 4380 4381 def run( 4382 self, 4383 execution: Execution, 4384 ) -> list[str]: 4385 """ 4386 Build command line arguments. This method is called by the main command. 4387 4388 Args: 4389 execution: The execution object. 4390 Returns: 4391 Command line arguments 4392 """ 4393 cargs = [] 4394 cargs.extend([ 4395 "-nospm", 4396 self.nospm 4397 ]) 4398 return cargs
-spm, -nospm: SPM compatibility in Analyze output
Syntax: -spm or -nospm
These options specify whether use the SPM extension to the Analyze (.hdr,.img) format. When this option is on, the origin field stored by SPM in the Analyze header will be correctly interpreted. When saving analyze files, the origin will be set correctly. The default is equivalent to the -nospm option. Best to avoid this issue altogether by using NIFTI and SPM5 or later.
c3d -spm in.hdr out.img.gz.
-spm, -nospm: SPM compatibility in Analyze output
Syntax: -spm or -nospm
These options specify whether use the SPM extension to the Analyze (.hdr,.img) format. When this option is on, the origin field stored by SPM in the Analyze header will be correctly interpreted. When saving analyze files, the origin will be set correctly. The default is equivalent to the -nospm option. Best to avoid this issue altogether by using NIFTI and SPM5 or later.
c3d -spm in.hdr out.img.gz
4381 def run( 4382 self, 4383 execution: Execution, 4384 ) -> list[str]: 4385 """ 4386 Build command line arguments. This method is called by the main command. 4387 4388 Args: 4389 execution: The execution object. 4390 Returns: 4391 Command line arguments 4392 """ 4393 cargs = [] 4394 cargs.extend([ 4395 "-nospm", 4396 self.nospm 4397 ]) 4398 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8074@dataclasses.dataclass 8075class C3dNoverbose: 8076 """ 8077 No description found. 8078 """ 8079 noverbose: str 8080 """No description found.""" 8081 8082 def run( 8083 self, 8084 execution: Execution, 8085 ) -> list[str]: 8086 """ 8087 Build command line arguments. This method is called by the main command. 8088 8089 Args: 8090 execution: The execution object. 8091 Returns: 8092 Command line arguments 8093 """ 8094 cargs = [] 8095 cargs.extend([ 8096 "-noverbose", 8097 self.noverbose 8098 ]) 8099 return cargs
No description found.
8082 def run( 8083 self, 8084 execution: Execution, 8085 ) -> list[str]: 8086 """ 8087 Build command line arguments. This method is called by the main command. 8088 8089 Args: 8090 execution: The execution object. 8091 Returns: 8092 Command line arguments 8093 """ 8094 cargs = [] 8095 cargs.extend([ 8096 "-noverbose", 8097 self.noverbose 8098 ]) 8099 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4590@dataclasses.dataclass 4591class C3dOrient: 4592 """ 4593 -orient: Change image orientation 4594 4595 Syntax: `-orient CODE` 4596 4597 Set the orientation of the image using one of 48 canonical orientations. The 4598 orientation describes the mapping from the voxel coordinate system (i,j,k) 4599 to the physical coordinate system (x,y,z). In the voxel coordinate system, i 4600 runs along columns of voxels, j runs along rows of voxels, and k runs along 4601 slices of voxels. It is assumed (by the NIFTI convention) that the axes of 4602 the physical coordinate system run as follows: x from (L)eft to (R)ight, y 4603 from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior. 4604 4605 The CODE passed in is a three-letter code consisting of letters RLAPSI. Each 4606 letter describes the anatomical direction corresponding to the voxel 4607 coordinates (i,j,k). For example, code RAI means that i runs from Right to 4608 Left, j from Anterior to Posterior, and k from Inferior to Superior. 4609 4610 c3d input.img -orient RAI -o output.img 4611 c3d input.img -orient SAL -o output.img 4612 4613 This command has the same behavior as the 'Reorient Image' menu option in 4614 ITK-SNAP. 4615 """ 4616 orient: str 4617 """-orient: Change image orientation 4618 4619 Syntax: `-orient CODE` 4620 4621 Set the orientation of the image using one of 48 canonical orientations. The 4622 orientation describes the mapping from the voxel coordinate system (i,j,k) 4623 to the physical coordinate system (x,y,z). In the voxel coordinate system, i 4624 runs along columns of voxels, j runs along rows of voxels, and k runs along 4625 slices of voxels. It is assumed (by the NIFTI convention) that the axes of 4626 the physical coordinate system run as follows: x from (L)eft to (R)ight, y 4627 from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior. 4628 4629 The CODE passed in is a three-letter code consisting of letters RLAPSI. Each 4630 letter describes the anatomical direction corresponding to the voxel 4631 coordinates (i,j,k). For example, code RAI means that i runs from Right to 4632 Left, j from Anterior to Posterior, and k from Inferior to Superior. 4633 4634 c3d input.img -orient RAI -o output.img 4635 c3d input.img -orient SAL -o output.img 4636 4637 This command has the same behavior as the 'Reorient Image' menu option in 4638 ITK-SNAP.""" 4639 4640 def run( 4641 self, 4642 execution: Execution, 4643 ) -> list[str]: 4644 """ 4645 Build command line arguments. This method is called by the main command. 4646 4647 Args: 4648 execution: The execution object. 4649 Returns: 4650 Command line arguments 4651 """ 4652 cargs = [] 4653 cargs.extend([ 4654 "-orient", 4655 self.orient 4656 ]) 4657 return cargs
-orient: Change image orientation
Syntax: -orient CODE
Set the orientation of the image using one of 48 canonical orientations. The orientation describes the mapping from the voxel coordinate system (i,j,k) to the physical coordinate system (x,y,z). In the voxel coordinate system, i runs along columns of voxels, j runs along rows of voxels, and k runs along slices of voxels. It is assumed (by the NIFTI convention) that the axes of the physical coordinate system run as follows: x from (L)eft to (R)ight, y from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior.
The CODE passed in is a three-letter code consisting of letters RLAPSI. Each letter describes the anatomical direction corresponding to the voxel coordinates (i,j,k). For example, code RAI means that i runs from Right to Left, j from Anterior to Posterior, and k from Inferior to Superior.
c3d input.img -orient RAI -o output.img c3d input.img -orient SAL -o output.img
This command has the same behavior as the 'Reorient Image' menu option in ITK-SNAP.
-orient: Change image orientation
Syntax: -orient CODE
Set the orientation of the image using one of 48 canonical orientations. The orientation describes the mapping from the voxel coordinate system (i,j,k) to the physical coordinate system (x,y,z). In the voxel coordinate system, i runs along columns of voxels, j runs along rows of voxels, and k runs along slices of voxels. It is assumed (by the NIFTI convention) that the axes of the physical coordinate system run as follows: x from (L)eft to (R)ight, y from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior.
The CODE passed in is a three-letter code consisting of letters RLAPSI. Each letter describes the anatomical direction corresponding to the voxel coordinates (i,j,k). For example, code RAI means that i runs from Right to Left, j from Anterior to Posterior, and k from Inferior to Superior.
c3d input.img -orient RAI -o output.img c3d input.img -orient SAL -o output.img
This command has the same behavior as the 'Reorient Image' menu option in ITK-SNAP.
4640 def run( 4641 self, 4642 execution: Execution, 4643 ) -> list[str]: 4644 """ 4645 Build command line arguments. This method is called by the main command. 4646 4647 Args: 4648 execution: The execution object. 4649 Returns: 4650 Command line arguments 4651 """ 4652 cargs = [] 4653 cargs.extend([ 4654 "-orient", 4655 self.orient 4656 ]) 4657 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4734@dataclasses.dataclass 4735class C3dOrient_: 4736 """ 4737 -orient: Change image orientation 4738 4739 Syntax: `-orient CODE` 4740 4741 Set the orientation of the image using one of 48 canonical orientations. The 4742 orientation describes the mapping from the voxel coordinate system (i,j,k) 4743 to the physical coordinate system (x,y,z). In the voxel coordinate system, i 4744 runs along columns of voxels, j runs along rows of voxels, and k runs along 4745 slices of voxels. It is assumed (by the NIFTI convention) that the axes of 4746 the physical coordinate system run as follows: x from (L)eft to (R)ight, y 4747 from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior. 4748 4749 The CODE passed in is a three-letter code consisting of letters RLAPSI. Each 4750 letter describes the anatomical direction corresponding to the voxel 4751 coordinates (i,j,k). For example, code RAI means that i runs from Right to 4752 Left, j from Anterior to Posterior, and k from Inferior to Superior. 4753 4754 c3d input.img -orient RAI -o output.img 4755 c3d input.img -orient SAL -o output.img 4756 4757 This command has the same behavior as the 'Reorient Image' menu option in 4758 ITK-SNAP. 4759 """ 4760 orient: str 4761 """-orient: Change image orientation 4762 4763 Syntax: `-orient CODE` 4764 4765 Set the orientation of the image using one of 48 canonical orientations. The 4766 orientation describes the mapping from the voxel coordinate system (i,j,k) 4767 to the physical coordinate system (x,y,z). In the voxel coordinate system, i 4768 runs along columns of voxels, j runs along rows of voxels, and k runs along 4769 slices of voxels. It is assumed (by the NIFTI convention) that the axes of 4770 the physical coordinate system run as follows: x from (L)eft to (R)ight, y 4771 from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior. 4772 4773 The CODE passed in is a three-letter code consisting of letters RLAPSI. Each 4774 letter describes the anatomical direction corresponding to the voxel 4775 coordinates (i,j,k). For example, code RAI means that i runs from Right to 4776 Left, j from Anterior to Posterior, and k from Inferior to Superior. 4777 4778 c3d input.img -orient RAI -o output.img 4779 c3d input.img -orient SAL -o output.img 4780 4781 This command has the same behavior as the 'Reorient Image' menu option in 4782 ITK-SNAP.""" 4783 4784 def run( 4785 self, 4786 execution: Execution, 4787 ) -> list[str]: 4788 """ 4789 Build command line arguments. This method is called by the main command. 4790 4791 Args: 4792 execution: The execution object. 4793 Returns: 4794 Command line arguments 4795 """ 4796 cargs = [] 4797 cargs.extend([ 4798 "-orient", 4799 self.orient 4800 ]) 4801 return cargs
-orient: Change image orientation
Syntax: -orient CODE
Set the orientation of the image using one of 48 canonical orientations. The orientation describes the mapping from the voxel coordinate system (i,j,k) to the physical coordinate system (x,y,z). In the voxel coordinate system, i runs along columns of voxels, j runs along rows of voxels, and k runs along slices of voxels. It is assumed (by the NIFTI convention) that the axes of the physical coordinate system run as follows: x from (L)eft to (R)ight, y from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior.
The CODE passed in is a three-letter code consisting of letters RLAPSI. Each letter describes the anatomical direction corresponding to the voxel coordinates (i,j,k). For example, code RAI means that i runs from Right to Left, j from Anterior to Posterior, and k from Inferior to Superior.
c3d input.img -orient RAI -o output.img c3d input.img -orient SAL -o output.img
This command has the same behavior as the 'Reorient Image' menu option in ITK-SNAP.
-orient: Change image orientation
Syntax: -orient CODE
Set the orientation of the image using one of 48 canonical orientations. The orientation describes the mapping from the voxel coordinate system (i,j,k) to the physical coordinate system (x,y,z). In the voxel coordinate system, i runs along columns of voxels, j runs along rows of voxels, and k runs along slices of voxels. It is assumed (by the NIFTI convention) that the axes of the physical coordinate system run as follows: x from (L)eft to (R)ight, y from (P)osterior to (A)nterior, z from (I)nferior to (S)uperior.
The CODE passed in is a three-letter code consisting of letters RLAPSI. Each letter describes the anatomical direction corresponding to the voxel coordinates (i,j,k). For example, code RAI means that i runs from Right to Left, j from Anterior to Posterior, and k from Inferior to Superior.
c3d input.img -orient RAI -o output.img c3d input.img -orient SAL -o output.img
This command has the same behavior as the 'Reorient Image' menu option in ITK-SNAP.
4784 def run( 4785 self, 4786 execution: Execution, 4787 ) -> list[str]: 4788 """ 4789 Build command line arguments. This method is called by the main command. 4790 4791 Args: 4792 execution: The execution object. 4793 Returns: 4794 Command line arguments 4795 """ 4796 cargs = [] 4797 cargs.extend([ 4798 "-orient", 4799 self.orient 4800 ]) 4801 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4804@dataclasses.dataclass 4805class C3dOrigin: 4806 """ 4807 -origin: Set image origin 4808 4809 Syntax: `-origin vector ` 4810 4811 Set the origin of the image. The origin is the world coordinate (in NIfTI 4812 coordinate space) of the center of the voxel (0,0,0) in the image. The 4813 origin should be specified in millimeters. 4814 4815 c3d input.img -origin 100x100x100mm -o output.img. 4816 """ 4817 origin: str 4818 """-origin: Set image origin 4819 4820 Syntax: `-origin vector ` 4821 4822 Set the origin of the image. The origin is the world coordinate (in NIfTI 4823 coordinate space) of the center of the voxel (0,0,0) in the image. The 4824 origin should be specified in millimeters. 4825 4826 c3d input.img -origin 100x100x100mm -o output.img""" 4827 4828 def run( 4829 self, 4830 execution: Execution, 4831 ) -> list[str]: 4832 """ 4833 Build command line arguments. This method is called by the main command. 4834 4835 Args: 4836 execution: The execution object. 4837 Returns: 4838 Command line arguments 4839 """ 4840 cargs = [] 4841 cargs.extend([ 4842 "-origin", 4843 self.origin 4844 ]) 4845 return cargs
-origin: Set image origin
Syntax: -origin vector
Set the origin of the image. The origin is the world coordinate (in NIfTI coordinate space) of the center of the voxel (0,0,0) in the image. The origin should be specified in millimeters.
c3d input.img -origin 100x100x100mm -o output.img.
-origin: Set image origin
Syntax: -origin vector
Set the origin of the image. The origin is the world coordinate (in NIfTI coordinate space) of the center of the voxel (0,0,0) in the image. The origin should be specified in millimeters.
c3d input.img -origin 100x100x100mm -o output.img
4828 def run( 4829 self, 4830 execution: Execution, 4831 ) -> list[str]: 4832 """ 4833 Build command line arguments. This method is called by the main command. 4834 4835 Args: 4836 execution: The execution object. 4837 Returns: 4838 Command line arguments 4839 """ 4840 cargs = [] 4841 cargs.extend([ 4842 "-origin", 4843 self.origin 4844 ]) 4845 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4848@dataclasses.dataclass 4849class C3dOriginVoxel: 4850 """ 4851 -origin-voxel: Assign image origin to a voxel 4852 4853 Syntax: `-origin-voxel vector ` 4854 4855 Set the origin of the image by specifying the voxel coordinates of the 4856 center of the patient (RAS) coordinate system. The vector should be 4857 specified in voxel units. 4858 4859 c3d input.img -origin-voxel 60x70x35 -o output.img 4860 c3d input.img -origin-voxel 50% -o output.img # image centered around 4861 origin. 4862 """ 4863 origin_voxel: str 4864 """-origin-voxel: Assign image origin to a voxel 4865 4866 Syntax: `-origin-voxel vector ` 4867 4868 Set the origin of the image by specifying the voxel coordinates of the 4869 center of the patient (RAS) coordinate system. The vector should be 4870 specified in voxel units. 4871 4872 c3d input.img -origin-voxel 60x70x35 -o output.img 4873 c3d input.img -origin-voxel 50% -o output.img # image centered around 4874 origin""" 4875 4876 def run( 4877 self, 4878 execution: Execution, 4879 ) -> list[str]: 4880 """ 4881 Build command line arguments. This method is called by the main command. 4882 4883 Args: 4884 execution: The execution object. 4885 Returns: 4886 Command line arguments 4887 """ 4888 cargs = [] 4889 cargs.extend([ 4890 "-origin-voxel", 4891 self.origin_voxel 4892 ]) 4893 return cargs
-origin-voxel: Assign image origin to a voxel
Syntax: -origin-voxel vector
Set the origin of the image by specifying the voxel coordinates of the center of the patient (RAS) coordinate system. The vector should be specified in voxel units.
c3d input.img -origin-voxel 60x70x35 -o output.img c3d input.img -origin-voxel 50% -o output.img # image centered around origin.
-origin-voxel: Assign image origin to a voxel
Syntax: -origin-voxel vector
Set the origin of the image by specifying the voxel coordinates of the center of the patient (RAS) coordinate system. The vector should be specified in voxel units.
c3d input.img -origin-voxel 60x70x35 -o output.img c3d input.img -origin-voxel 50% -o output.img # image centered around origin
4876 def run( 4877 self, 4878 execution: Execution, 4879 ) -> list[str]: 4880 """ 4881 Build command line arguments. This method is called by the main command. 4882 4883 Args: 4884 execution: The execution object. 4885 Returns: 4886 Command line arguments 4887 """ 4888 cargs = [] 4889 cargs.extend([ 4890 "-origin-voxel", 4891 self.origin_voxel 4892 ]) 4893 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4896@dataclasses.dataclass 4897class C3dOriginVoxelCoord: 4898 """ 4899 -origin-voxel-coord: Set coordinate of specified voxel 4900 4901 Syntax: `-origin-voxel-coord: <index> <vector>` 4902 4903 This command updates the origin of the image such that the specifed voxel 4904 has the specified coordinate. For example, you can use the command to set 4905 the world coordinate (in NIFTI coordinate space) of the center voxel of the 4906 image, as follows: 4907 4908 c3d input.nii -origin-voxel-coord: 50% 10x10x5mm -o output.nii. 4909 """ 4910 origin_voxel_coord: str 4911 """-origin-voxel-coord: Set coordinate of specified voxel 4912 4913 Syntax: `-origin-voxel-coord: <index> <vector>` 4914 4915 This command updates the origin of the image such that the specifed voxel 4916 has the specified coordinate. For example, you can use the command to set 4917 the world coordinate (in NIFTI coordinate space) of the center voxel of the 4918 image, as follows: 4919 4920 c3d input.nii -origin-voxel-coord: 50% 10x10x5mm -o output.nii""" 4921 4922 def run( 4923 self, 4924 execution: Execution, 4925 ) -> list[str]: 4926 """ 4927 Build command line arguments. This method is called by the main command. 4928 4929 Args: 4930 execution: The execution object. 4931 Returns: 4932 Command line arguments 4933 """ 4934 cargs = [] 4935 cargs.extend([ 4936 "-origin-voxel-coord", 4937 self.origin_voxel_coord 4938 ]) 4939 return cargs
-origin-voxel-coord: Set coordinate of specified voxel
Syntax: -origin-voxel-coord: <index> <vector>
This command updates the origin of the image such that the specifed voxel has the specified coordinate. For example, you can use the command to set the world coordinate (in NIFTI coordinate space) of the center voxel of the image, as follows:
c3d input.nii -origin-voxel-coord: 50% 10x10x5mm -o output.nii.
-origin-voxel-coord: Set coordinate of specified voxel
Syntax: -origin-voxel-coord: <index> <vector>
This command updates the origin of the image such that the specifed voxel has the specified coordinate. For example, you can use the command to set the world coordinate (in NIFTI coordinate space) of the center voxel of the image, as follows:
c3d input.nii -origin-voxel-coord: 50% 10x10x5mm -o output.nii
4922 def run( 4923 self, 4924 execution: Execution, 4925 ) -> list[str]: 4926 """ 4927 Build command line arguments. This method is called by the main command. 4928 4929 Args: 4930 execution: The execution object. 4931 Returns: 4932 Command line arguments 4933 """ 4934 cargs = [] 4935 cargs.extend([ 4936 "-origin-voxel-coord", 4937 self.origin_voxel_coord 4938 ]) 4939 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4401@dataclasses.dataclass 4402class C3dOutput: 4403 """ 4404 -o: Output (write) last image on the stack to image file 4405 4406 Syntax: `-o filename` 4407 4408 Write image, overriding an existing image. Without the **-o** option, 4409 **convert3d** will write an image only if it does not exist. The **-o** 4410 options protects input images from being accidentally deleted. Here we copy 4411 an image, changing format: 4412 4413 c3d image1.mha -o image2.nii 4414 4415 The **-o** option can also be used to save an intermediate image in the 4416 stack: 4417 4418 c3d image1.img -threshold 1 10 1 0 -o thresh.img -resample 50% -o final.img. 4419 """ 4420 output: str 4421 """-o: Output (write) last image on the stack to image file 4422 4423 Syntax: `-o filename` 4424 4425 Write image, overriding an existing image. Without the **-o** option, 4426 **convert3d** will write an image only if it does not exist. The **-o** 4427 options protects input images from being accidentally deleted. Here we copy 4428 an image, changing format: 4429 4430 c3d image1.mha -o image2.nii 4431 4432 The **-o** option can also be used to save an intermediate image in the 4433 stack: 4434 4435 c3d image1.img -threshold 1 10 1 0 -o thresh.img -resample 50% -o 4436 final.img""" 4437 4438 def run( 4439 self, 4440 execution: Execution, 4441 ) -> list[str]: 4442 """ 4443 Build command line arguments. This method is called by the main command. 4444 4445 Args: 4446 execution: The execution object. 4447 Returns: 4448 Command line arguments 4449 """ 4450 cargs = [] 4451 cargs.extend([ 4452 "-o", 4453 self.output 4454 ]) 4455 return cargs
-o: Output (write) last image on the stack to image file
Syntax: -o filename
Write image, overriding an existing image. Without the -o option, convert3d will write an image only if it does not exist. The -o options protects input images from being accidentally deleted. Here we copy an image, changing format:
c3d image1.mha -o image2.nii
The -o option can also be used to save an intermediate image in the stack:
c3d image1.img -threshold 1 10 1 0 -o thresh.img -resample 50% -o final.img.
-o: Output (write) last image on the stack to image file
Syntax: -o filename
Write image, overriding an existing image. Without the -o option, convert3d will write an image only if it does not exist. The -o options protects input images from being accidentally deleted. Here we copy an image, changing format:
c3d image1.mha -o image2.nii
The -o option can also be used to save an intermediate image in the stack:
c3d image1.img -threshold 1 10 1 0 -o thresh.img -resample 50% -o final.img
4438 def run( 4439 self, 4440 execution: Execution, 4441 ) -> list[str]: 4442 """ 4443 Build command line arguments. This method is called by the main command. 4444 4445 Args: 4446 execution: The execution object. 4447 Returns: 4448 Command line arguments 4449 """ 4450 cargs = [] 4451 cargs.extend([ 4452 "-o", 4453 self.output 4454 ]) 4455 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4458@dataclasses.dataclass 4459class C3dOutputMulticomponent: 4460 """ 4461 -omc, -output-multicomponent: Output multiple images to single file 4462 4463 Syntax: `-omc [number] filename` 4464 4465 Write multiple images on the **Convert3d** stack as a single multi-component 4466 image file. If the optional number *n* is specified, only the last *n* 4467 images on the stack will be used. Not all file formats support 4468 multi-component output. NIFTI is the safest bet. 4469 4470 c3d red.nii green.nii blue.nii -omc rgb.mha 4471 4472 For 2D images, this command can be used to generate color PNG files: 4473 4474 c3d image.nii -slice z 50% -colormap jet -type uchar -omc colorslice.png. 4475 """ 4476 output_multicomponent: str 4477 """-omc, -output-multicomponent: Output multiple images to single file 4478 4479 Syntax: `-omc [number] filename` 4480 4481 Write multiple images on the **Convert3d** stack as a single multi-component 4482 image file. If the optional number *n* is specified, only the last *n* 4483 images on the stack will be used. Not all file formats support 4484 multi-component output. NIFTI is the safest bet. 4485 4486 c3d red.nii green.nii blue.nii -omc rgb.mha 4487 4488 For 2D images, this command can be used to generate color PNG files: 4489 4490 c3d image.nii -slice z 50% -colormap jet -type uchar -omc colorslice.png""" 4491 4492 def run( 4493 self, 4494 execution: Execution, 4495 ) -> list[str]: 4496 """ 4497 Build command line arguments. This method is called by the main command. 4498 4499 Args: 4500 execution: The execution object. 4501 Returns: 4502 Command line arguments 4503 """ 4504 cargs = [] 4505 cargs.extend([ 4506 "-omc", 4507 self.output_multicomponent 4508 ]) 4509 return cargs
-omc, -output-multicomponent: Output multiple images to single file
Syntax: -omc [number] filename
Write multiple images on the Convert3d stack as a single multi-component image file. If the optional number n is specified, only the last n images on the stack will be used. Not all file formats support multi-component output. NIFTI is the safest bet.
c3d red.nii green.nii blue.nii -omc rgb.mha
For 2D images, this command can be used to generate color PNG files:
c3d image.nii -slice z 50% -colormap jet -type uchar -omc colorslice.png.
-omc, -output-multicomponent: Output multiple images to single file
Syntax: -omc [number] filename
Write multiple images on the Convert3d stack as a single multi-component image file. If the optional number n is specified, only the last n images on the stack will be used. Not all file formats support multi-component output. NIFTI is the safest bet.
c3d red.nii green.nii blue.nii -omc rgb.mha
For 2D images, this command can be used to generate color PNG files:
c3d image.nii -slice z 50% -colormap jet -type uchar -omc colorslice.png
4492 def run( 4493 self, 4494 execution: Execution, 4495 ) -> list[str]: 4496 """ 4497 Build command line arguments. This method is called by the main command. 4498 4499 Args: 4500 execution: The execution object. 4501 Returns: 4502 Command line arguments 4503 """ 4504 cargs = [] 4505 cargs.extend([ 4506 "-omc", 4507 self.output_multicomponent 4508 ]) 4509 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4660@dataclasses.dataclass 4661class C3dOutputMultiple: 4662 """ 4663 -oo: Output multiple images to multiple files 4664 4665 Syntax: `-oo image_list` or `-oo image_spec` 4666 4667 Write all images on the **convert3d** stack as multiple files. There are two 4668 ways to use this command. The first is to supply a list of file names, 4669 separated by spaces: 4670 4671 c3d labelimage.nii -split -oo labelA.nii labelB.nii labelC.nii 4672 4673 In the above example, the image at the end of the stack will be saved as 4674 *labelC.nii*, the image next to the end of the stack will be saved as 4675 *labelB.nii* and so on. 4676 4677 The second way to use the **-oo** command is to supply a pattern for the 4678 output filenames. In this case, all the images on the stack will be written. 4679 The format for the pattern is the same as for the [C++ printf command][8]. 4680 For example, the following command 4681 4682 c3d labelimage.nii -split -oo label%02d.nii 4683 4684 will generate images *label00.nii*, *label01.nii*, *label02.nii* and so on. 4685 The image at the end of the stack will have the highest number, and the 4686 image at the beginning of the stack will have number 00. 4687 """ 4688 output_multiple: str 4689 """-oo: Output multiple images to multiple files 4690 4691 Syntax: `-oo image_list` or `-oo image_spec` 4692 4693 Write all images on the **convert3d** stack as multiple files. There are two 4694 ways to use this command. The first is to supply a list of file names, 4695 separated by spaces: 4696 4697 c3d labelimage.nii -split -oo labelA.nii labelB.nii labelC.nii 4698 4699 In the above example, the image at the end of the stack will be saved as 4700 *labelC.nii*, the image next to the end of the stack will be saved as 4701 *labelB.nii* and so on. 4702 4703 The second way to use the **-oo** command is to supply a pattern for the 4704 output filenames. In this case, all the images on the stack will be written. 4705 The format for the pattern is the same as for the [C++ printf command][8]. 4706 For example, the following command 4707 4708 c3d labelimage.nii -split -oo label%02d.nii 4709 4710 will generate images *label00.nii*, *label01.nii*, *label02.nii* and so on. 4711 The image at the end of the stack will have the highest number, and the 4712 image at the beginning of the stack will have number 00.""" 4713 4714 def run( 4715 self, 4716 execution: Execution, 4717 ) -> list[str]: 4718 """ 4719 Build command line arguments. This method is called by the main command. 4720 4721 Args: 4722 execution: The execution object. 4723 Returns: 4724 Command line arguments 4725 """ 4726 cargs = [] 4727 cargs.extend([ 4728 "-oo", 4729 self.output_multiple 4730 ]) 4731 return cargs
-oo: Output multiple images to multiple files
Syntax: -oo image_list or -oo image_spec
Write all images on the convert3d stack as multiple files. There are two ways to use this command. The first is to supply a list of file names, separated by spaces:
c3d labelimage.nii -split -oo labelA.nii labelB.nii labelC.nii
In the above example, the image at the end of the stack will be saved as labelC.nii, the image next to the end of the stack will be saved as labelB.nii and so on.
The second way to use the -oo command is to supply a pattern for the output filenames. In this case, all the images on the stack will be written. The format for the pattern is the same as for the [C++ printf command][8]. For example, the following command
c3d labelimage.nii -split -oo label%02d.nii
will generate images label00.nii, label01.nii, label02.nii and so on. The image at the end of the stack will have the highest number, and the image at the beginning of the stack will have number 00.
-oo: Output multiple images to multiple files
Syntax: -oo image_list or -oo image_spec
Write all images on the convert3d stack as multiple files. There are two ways to use this command. The first is to supply a list of file names, separated by spaces:
c3d labelimage.nii -split -oo labelA.nii labelB.nii labelC.nii
In the above example, the image at the end of the stack will be saved as labelC.nii, the image next to the end of the stack will be saved as labelB.nii and so on.
The second way to use the -oo command is to supply a pattern for the output filenames. In this case, all the images on the stack will be written. The format for the pattern is the same as for the [C++ printf command][8]. For example, the following command
c3d labelimage.nii -split -oo label%02d.nii
will generate images label00.nii, label01.nii, label02.nii and so on. The image at the end of the stack will have the highest number, and the image at the beginning of the stack will have number 00.
4714 def run( 4715 self, 4716 execution: Execution, 4717 ) -> list[str]: 4718 """ 4719 Build command line arguments. This method is called by the main command. 4720 4721 Args: 4722 execution: The execution object. 4723 Returns: 4724 Command line arguments 4725 """ 4726 cargs = [] 4727 cargs.extend([ 4728 "-oo", 4729 self.output_multiple 4730 ]) 4731 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
4512@dataclasses.dataclass 4513class C3dOutputMultipleMulticomponent: 4514 """ 4515 -oomc: Output multiple multi-component images to multiple files 4516 4517 Syntax: `-oomc n_comp image_list` or `-oomc n_comp image_spec` 4518 4519 Write all images on the **convert3d** stack as multiple multi-component 4520 image files. The command is a mixture of the **-omc** and **-oo** commands. 4521 There must be a multiple of 'n_comp' images on the stack. Every consecutive 4522 'n_comp' images on the stack will be written to a separate multi-component 4523 image. 4524 4525 ### Commands: Stack Manipulation and Flow Control 4526 4527 These commands are used to manipulate the **convert3d** stack. The stack is 4528 a linear array of images. Every time an image is specified on the command 4529 line, it is loaded and placed at the end of the stack. Most operations take 4530 one image from the end of the stack, apply some operation to it, and place 4531 the result on the end of the stack. Certain commands like **-levelset** and 4532 **-reslice-matrix** take two images from the end of the stack as the input 4533 and replace them with a single output. Some other commands, like **-mean** 4534 and **-vote** take all images on the stack and replace them with a single 4535 output. 4536 4537 Sometimes, for complex operations, it is useful to change the order of the 4538 images on the stack, to duplicate images, or to execute the same command 4539 multiple times. The stack manipulation and flow control commands allow you 4540 to complete complex tasks without saving intermediate images to the disk. 4541 """ 4542 output_multiple_multicomponent: str 4543 """-oomc: Output multiple multi-component images to multiple files 4544 4545 Syntax: `-oomc n_comp image_list` or `-oomc n_comp image_spec` 4546 4547 Write all images on the **convert3d** stack as multiple multi-component 4548 image files. The command is a mixture of the **-omc** and **-oo** commands. 4549 There must be a multiple of 'n_comp' images on the stack. Every consecutive 4550 'n_comp' images on the stack will be written to a separate multi-component 4551 image. 4552 4553 ### Commands: Stack Manipulation and Flow Control 4554 4555 These commands are used to manipulate the **convert3d** stack. The stack is 4556 a linear array of images. Every time an image is specified on the command 4557 line, it is loaded and placed at the end of the stack. Most operations take 4558 one image from the end of the stack, apply some operation to it, and place 4559 the result on the end of the stack. Certain commands like **-levelset** and 4560 **-reslice-matrix** take two images from the end of the stack as the input 4561 and replace them with a single output. Some other commands, like **-mean** 4562 and **-vote** take all images on the stack and replace them with a single 4563 output. 4564 4565 Sometimes, for complex operations, it is useful to change the order of the 4566 images on the stack, to duplicate images, or to execute the same command 4567 multiple times. The stack manipulation and flow control commands allow you 4568 to complete complex tasks without saving intermediate images to the disk.""" 4569 4570 def run( 4571 self, 4572 execution: Execution, 4573 ) -> list[str]: 4574 """ 4575 Build command line arguments. This method is called by the main command. 4576 4577 Args: 4578 execution: The execution object. 4579 Returns: 4580 Command line arguments 4581 """ 4582 cargs = [] 4583 cargs.extend([ 4584 "-oomc", 4585 self.output_multiple_multicomponent 4586 ]) 4587 return cargs
-oomc: Output multiple multi-component images to multiple files
Syntax: -oomc n_comp image_list or -oomc n_comp image_spec
Write all images on the convert3d stack as multiple multi-component image files. The command is a mixture of the -omc and -oo commands. There must be a multiple of 'n_comp' images on the stack. Every consecutive 'n_comp' images on the stack will be written to a separate multi-component image.
Commands: Stack Manipulation and Flow Control
These commands are used to manipulate the convert3d stack. The stack is a linear array of images. Every time an image is specified on the command line, it is loaded and placed at the end of the stack. Most operations take one image from the end of the stack, apply some operation to it, and place the result on the end of the stack. Certain commands like -levelset and -reslice-matrix take two images from the end of the stack as the input and replace them with a single output. Some other commands, like -mean and -vote take all images on the stack and replace them with a single output.
Sometimes, for complex operations, it is useful to change the order of the images on the stack, to duplicate images, or to execute the same command multiple times. The stack manipulation and flow control commands allow you to complete complex tasks without saving intermediate images to the disk.
-oomc: Output multiple multi-component images to multiple files
Syntax: -oomc n_comp image_list or -oomc n_comp image_spec
Write all images on the convert3d stack as multiple multi-component image files. The command is a mixture of the -omc and -oo commands. There must be a multiple of 'n_comp' images on the stack. Every consecutive 'n_comp' images on the stack will be written to a separate multi-component image.
Commands: Stack Manipulation and Flow Control
These commands are used to manipulate the convert3d stack. The stack is a linear array of images. Every time an image is specified on the command line, it is loaded and placed at the end of the stack. Most operations take one image from the end of the stack, apply some operation to it, and place the result on the end of the stack. Certain commands like -levelset and -reslice-matrix take two images from the end of the stack as the input and replace them with a single output. Some other commands, like -mean and -vote take all images on the stack and replace them with a single output.
Sometimes, for complex operations, it is useful to change the order of the images on the stack, to duplicate images, or to execute the same command multiple times. The stack manipulation and flow control commands allow you to complete complex tasks without saving intermediate images to the disk.
4570 def run( 4571 self, 4572 execution: Execution, 4573 ) -> list[str]: 4574 """ 4575 Build command line arguments. This method is called by the main command. 4576 4577 Args: 4578 execution: The execution object. 4579 Returns: 4580 Command line arguments 4581 """ 4582 cargs = [] 4583 cargs.extend([ 4584 "-oomc", 4585 self.output_multiple_multicomponent 4586 ]) 4587 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8760class C3dOutputs(typing.NamedTuple): 8761 """ 8762 Output object returned when calling `c3d_(...)`. 8763 """ 8764 root: OutputPathType 8765 """Output root folder. This is the root folder for all outputs."""
Output object returned when calling c3d_(...).
Inherited Members
- builtins.tuple
- index
- count
4942@dataclasses.dataclass 4943class C3dOverlap: 4944 """ 4945 -overlap: Compute relative overlap between binary images 4946 4947 Syntax: `-overlap Z` 4948 4949 Compute relative overlap between labels in the last two images on the stack. 4950 Overlap is computed for a given label **Z**, i.e., the number of voxels that 4951 are equal to **Z** in both images is computed and divided by either the 4952 average number of voxels equal to **Z** in both images (to get Dice 4953 coefficient) or by the size of the region where at least one of the images 4954 is equal to **Z** (Jaccard coefficient). 4955 4956 The command below computes overlap for label 255. 4957 4958 c3d -verbose seg1.img seg2.img -overlap 255 4959 4960 The output of the command is in the following terse format, with the last 4961 two values giving Dice and Jaccard coefficients, respectively. 4962 4963 OVL: 1, 2383, 2474, 1807, 0.744081, 0.592459 4964 4965 Use the flag **-verbose** to get full information. 4966 4967 Matching voxels in first image: 2383 4968 Matching voxels in second image: 2474 4969 Size of overlap region: 1807 4970 Dice similarity coefficient: 0.744081 4971 Intersection / ratio: 0.592459 4972 4973 This command does not alter the stack. 4974 """ 4975 overlap: str 4976 """-overlap: Compute relative overlap between binary images 4977 4978 Syntax: `-overlap Z` 4979 4980 Compute relative overlap between labels in the last two images on the stack. 4981 Overlap is computed for a given label **Z**, i.e., the number of voxels that 4982 are equal to **Z** in both images is computed and divided by either the 4983 average number of voxels equal to **Z** in both images (to get Dice 4984 coefficient) or by the size of the region where at least one of the images 4985 is equal to **Z** (Jaccard coefficient). 4986 4987 The command below computes overlap for label 255. 4988 4989 c3d -verbose seg1.img seg2.img -overlap 255 4990 4991 The output of the command is in the following terse format, with the last 4992 two values giving Dice and Jaccard coefficients, respectively. 4993 4994 OVL: 1, 2383, 2474, 1807, 0.744081, 0.592459 4995 4996 Use the flag **-verbose** to get full information. 4997 4998 Matching voxels in first image: 2383 4999 Matching voxels in second image: 2474 5000 Size of overlap region: 1807 5001 Dice similarity coefficient: 0.744081 5002 Intersection / ratio: 0.592459 5003 5004 This command does not alter the stack.""" 5005 5006 def run( 5007 self, 5008 execution: Execution, 5009 ) -> list[str]: 5010 """ 5011 Build command line arguments. This method is called by the main command. 5012 5013 Args: 5014 execution: The execution object. 5015 Returns: 5016 Command line arguments 5017 """ 5018 cargs = [] 5019 cargs.extend([ 5020 "-overlap", 5021 self.overlap 5022 ]) 5023 return cargs
-overlap: Compute relative overlap between binary images
Syntax: -overlap Z
Compute relative overlap between labels in the last two images on the stack. Overlap is computed for a given label Z, i.e., the number of voxels that are equal to Z in both images is computed and divided by either the average number of voxels equal to Z in both images (to get Dice coefficient) or by the size of the region where at least one of the images is equal to Z (Jaccard coefficient).
The command below computes overlap for label 255.
c3d -verbose seg1.img seg2.img -overlap 255
The output of the command is in the following terse format, with the last two values giving Dice and Jaccard coefficients, respectively.
OVL: 1, 2383, 2474, 1807, 0.744081, 0.592459
Use the flag -verbose to get full information.
Matching voxels in first image: 2383 Matching voxels in second image: 2474 Size of overlap region: 1807 Dice similarity coefficient: 0.744081 Intersection / ratio: 0.592459
This command does not alter the stack.
-overlap: Compute relative overlap between binary images
Syntax: -overlap Z
Compute relative overlap between labels in the last two images on the stack. Overlap is computed for a given label Z, i.e., the number of voxels that are equal to Z in both images is computed and divided by either the average number of voxels equal to Z in both images (to get Dice coefficient) or by the size of the region where at least one of the images is equal to Z (Jaccard coefficient).
The command below computes overlap for label 255.
c3d -verbose seg1.img seg2.img -overlap 255
The output of the command is in the following terse format, with the last two values giving Dice and Jaccard coefficients, respectively.
OVL: 1, 2383, 2474, 1807, 0.744081, 0.592459
Use the flag -verbose to get full information.
Matching voxels in first image: 2383 Matching voxels in second image: 2474 Size of overlap region: 1807 Dice similarity coefficient: 0.744081 Intersection / ratio: 0.592459
This command does not alter the stack.
5006 def run( 5007 self, 5008 execution: Execution, 5009 ) -> list[str]: 5010 """ 5011 Build command line arguments. This method is called by the main command. 5012 5013 Args: 5014 execution: The execution object. 5015 Returns: 5016 Command line arguments 5017 """ 5018 cargs = [] 5019 cargs.extend([ 5020 "-overlap", 5021 self.overlap 5022 ]) 5023 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5026@dataclasses.dataclass 5027class C3dOverlayLabelImage: 5028 """ 5029 -oli, -overlay-label-image: Overlay segmentation image on grayscale image 5030 5031 Syntax: `-oli lookup_table_file opacity` 5032 5033 This command takes a grayscale image and a label image (i.e. image with a 5034 set of discrete values) and produces red, green and blue components of a 5035 color image. The resulting color image is an overlay of the labels over the 5036 grey image. The first parameter (*lookup\_table*) is a text file with 5037 entries in the format 5038 5039 label_value red green blue alpha 5040 5041 Alpha values must be between 0 and 1. Red, green and blue values should be 5042 on the same order as the intensity of the grey image (typically 0-255). The 5043 text file is compatible with ITK-SNAP and can be generated using the 5044 ITK-SNAP `Segmentation->Save Label Descriptions` command. The second 5045 parameter (*opacity*) is between 0 and 1 and sets the overall opacity of the 5046 overlay. The output of this command is similar to the way ITK-SNAP presents 5047 segmentation data on top of grayscale images. 5048 5049 c3d gray.nii.gz -stretch 2% 98% 0 255 -clip 0 255 seg.nii.gz -oli labels.txt 5050 0.5 -omc rgb.nii.gz 5051 5052 Note: this command does not interpolate between entries in the lookup table. 5053 It should not be used for images with a continuous intensity spectrum. 5054 5055 Here is a more complex example, used to visualize a segmentation result. We 5056 do a few things in this command: trim grayscale and segmentation images to 5057 an ROI around the object of interest; map intensity range of the grayscale 5058 image to 0-255; extract slices through the middle of the cropped images; 5059 overlay segmentation on the grayscale image; and save as a color PNG file. 5060 5061 c3d seg.nii.gz -trim 20x20x0vox -as S gray.nii.gz -stretch 2% 98% 0 255 5062 -clip 0 255 \\ 5063 -reslice-identity -push S -foreach -slice z 50% -flip xy -endfor \\ 5064 -oli labels.txt 0.5 -type uchar -omc ovl.png. 5065 """ 5066 overlay_label_image: str 5067 """-oli, -overlay-label-image: Overlay segmentation image on grayscale image 5068 5069 Syntax: `-oli lookup_table_file opacity` 5070 5071 This command takes a grayscale image and a label image (i.e. image with a 5072 set of discrete values) and produces red, green and blue components of a 5073 color image. The resulting color image is an overlay of the labels over the 5074 grey image. The first parameter (*lookup\_table*) is a text file with 5075 entries in the format 5076 5077 label_value red green blue alpha 5078 5079 Alpha values must be between 0 and 1. Red, green and blue values should be 5080 on the same order as the intensity of the grey image (typically 0-255). The 5081 text file is compatible with ITK-SNAP and can be generated using the 5082 ITK-SNAP `Segmentation->Save Label Descriptions` command. The second 5083 parameter (*opacity*) is between 0 and 1 and sets the overall opacity of the 5084 overlay. The output of this command is similar to the way ITK-SNAP presents 5085 segmentation data on top of grayscale images. 5086 5087 c3d gray.nii.gz -stretch 2% 98% 0 255 -clip 0 255 seg.nii.gz -oli labels.txt 5088 0.5 -omc rgb.nii.gz 5089 5090 Note: this command does not interpolate between entries in the lookup table. 5091 It should not be used for images with a continuous intensity spectrum. 5092 5093 Here is a more complex example, used to visualize a segmentation result. We 5094 do a few things in this command: trim grayscale and segmentation images to 5095 an ROI around the object of interest; map intensity range of the grayscale 5096 image to 0-255; extract slices through the middle of the cropped images; 5097 overlay segmentation on the grayscale image; and save as a color PNG file. 5098 5099 c3d seg.nii.gz -trim 20x20x0vox -as S gray.nii.gz -stretch 2% 98% 0 255 5100 -clip 0 255 \\ 5101 -reslice-identity -push S -foreach -slice z 50% -flip xy -endfor \\ 5102 -oli labels.txt 0.5 -type uchar -omc ovl.png""" 5103 5104 def run( 5105 self, 5106 execution: Execution, 5107 ) -> list[str]: 5108 """ 5109 Build command line arguments. This method is called by the main command. 5110 5111 Args: 5112 execution: The execution object. 5113 Returns: 5114 Command line arguments 5115 """ 5116 cargs = [] 5117 cargs.extend([ 5118 "-overlay-label-image", 5119 self.overlay_label_image 5120 ]) 5121 return cargs
-oli, -overlay-label-image: Overlay segmentation image on grayscale image
Syntax: -oli lookup_table_file opacity
This command takes a grayscale image and a label image (i.e. image with a set of discrete values) and produces red, green and blue components of a color image. The resulting color image is an overlay of the labels over the grey image. The first parameter (lookup_table) is a text file with entries in the format
label_value red green blue alpha
Alpha values must be between 0 and 1. Red, green and blue values should be
on the same order as the intensity of the grey image (typically 0-255). The
text file is compatible with ITK-SNAP and can be generated using the
ITK-SNAP Segmentation->Save Label Descriptions command. The second
parameter (opacity) is between 0 and 1 and sets the overall opacity of the
overlay. The output of this command is similar to the way ITK-SNAP presents
segmentation data on top of grayscale images.
c3d gray.nii.gz -stretch 2% 98% 0 255 -clip 0 255 seg.nii.gz -oli labels.txt 0.5 -omc rgb.nii.gz
Note: this command does not interpolate between entries in the lookup table. It should not be used for images with a continuous intensity spectrum.
Here is a more complex example, used to visualize a segmentation result. We do a few things in this command: trim grayscale and segmentation images to an ROI around the object of interest; map intensity range of the grayscale image to 0-255; extract slices through the middle of the cropped images; overlay segmentation on the grayscale image; and save as a color PNG file.
c3d seg.nii.gz -trim 20x20x0vox -as S gray.nii.gz -stretch 2% 98% 0 255 -clip 0 255 \ -reslice-identity -push S -foreach -slice z 50% -flip xy -endfor \ -oli labels.txt 0.5 -type uchar -omc ovl.png.
-oli, -overlay-label-image: Overlay segmentation image on grayscale image
Syntax: -oli lookup_table_file opacity
This command takes a grayscale image and a label image (i.e. image with a set of discrete values) and produces red, green and blue components of a color image. The resulting color image is an overlay of the labels over the grey image. The first parameter (lookup_table) is a text file with entries in the format
label_value red green blue alpha
Alpha values must be between 0 and 1. Red, green and blue values should be
on the same order as the intensity of the grey image (typically 0-255). The
text file is compatible with ITK-SNAP and can be generated using the
ITK-SNAP Segmentation->Save Label Descriptions command. The second
parameter (opacity) is between 0 and 1 and sets the overall opacity of the
overlay. The output of this command is similar to the way ITK-SNAP presents
segmentation data on top of grayscale images.
c3d gray.nii.gz -stretch 2% 98% 0 255 -clip 0 255 seg.nii.gz -oli labels.txt 0.5 -omc rgb.nii.gz
Note: this command does not interpolate between entries in the lookup table. It should not be used for images with a continuous intensity spectrum.
Here is a more complex example, used to visualize a segmentation result. We do a few things in this command: trim grayscale and segmentation images to an ROI around the object of interest; map intensity range of the grayscale image to 0-255; extract slices through the middle of the cropped images; overlay segmentation on the grayscale image; and save as a color PNG file.
c3d seg.nii.gz -trim 20x20x0vox -as S gray.nii.gz -stretch 2% 98% 0 255 -clip 0 255 \ -reslice-identity -push S -foreach -slice z 50% -flip xy -endfor \ -oli labels.txt 0.5 -type uchar -omc ovl.png
5104 def run( 5105 self, 5106 execution: Execution, 5107 ) -> list[str]: 5108 """ 5109 Build command line arguments. This method is called by the main command. 5110 5111 Args: 5112 execution: The execution object. 5113 Returns: 5114 Command line arguments 5115 """ 5116 cargs = [] 5117 cargs.extend([ 5118 "-overlay-label-image", 5119 self.overlay_label_image 5120 ]) 5121 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5124@dataclasses.dataclass 5125class C3dPad: 5126 """ 5127 -pad: Pad image with constant value 5128 5129 Syntax: `-pad <padlower> <padupper> <value> ` 5130 5131 Pads the image by a given percentage or number of voxels. The *padlower* 5132 dimension pads along the zero faces of the image, and the *padupper* 5133 dimension pads along the upper faces of the image. For example to add 1 5134 voxel to the left side of an image, do 5135 5136 c3d img1.nii -pad 1x0x0vox 0x0x0vox 0 -o padded.nii 5137 5138 while 5139 5140 c3d img1.nii -pad 2x2x4vox 0% 0 -o padded.nii 5141 5142 adds two voxels padding to the left and posterior sides, and four slices to 5143 the bottom of the image. Note that the first argument changes the location 5144 of voxel (0,0,0) and thus the origin of the output image will be changed to 5145 maintain anatomical alignment between the padded and original images. 5146 5147 Normally you will want to pad with zeros, but you can pad with any constant 5148 value, eg : 5149 5150 c3d img1.nii -pad 10% 10% 1 -o padded.nii 5151 5152 Adds 10% to all sides of the image, and fills the new voxels with the value 5153 1. 5154 """ 5155 pad: str 5156 """-pad: Pad image with constant value 5157 5158 Syntax: `-pad <padlower> <padupper> <value> ` 5159 5160 Pads the image by a given percentage or number of voxels. The *padlower* 5161 dimension pads along the zero faces of the image, and the *padupper* 5162 dimension pads along the upper faces of the image. For example to add 1 5163 voxel to the left side of an image, do 5164 5165 c3d img1.nii -pad 1x0x0vox 0x0x0vox 0 -o padded.nii 5166 5167 while 5168 5169 c3d img1.nii -pad 2x2x4vox 0% 0 -o padded.nii 5170 5171 adds two voxels padding to the left and posterior sides, and four slices to 5172 the bottom of the image. Note that the first argument changes the location 5173 of voxel (0,0,0) and thus the origin of the output image will be changed to 5174 maintain anatomical alignment between the padded and original images. 5175 5176 Normally you will want to pad with zeros, but you can pad with any constant 5177 value, eg : 5178 5179 c3d img1.nii -pad 10% 10% 1 -o padded.nii 5180 5181 Adds 10% to all sides of the image, and fills the new voxels with the value 5182 1.""" 5183 5184 def run( 5185 self, 5186 execution: Execution, 5187 ) -> list[str]: 5188 """ 5189 Build command line arguments. This method is called by the main command. 5190 5191 Args: 5192 execution: The execution object. 5193 Returns: 5194 Command line arguments 5195 """ 5196 cargs = [] 5197 cargs.extend([ 5198 "-pad", 5199 self.pad 5200 ]) 5201 return cargs
-pad: Pad image with constant value
Syntax: -pad <padlower> <padupper> <value>
Pads the image by a given percentage or number of voxels. The padlower dimension pads along the zero faces of the image, and the padupper dimension pads along the upper faces of the image. For example to add 1 voxel to the left side of an image, do
c3d img1.nii -pad 1x0x0vox 0x0x0vox 0 -o padded.nii
while
c3d img1.nii -pad 2x2x4vox 0% 0 -o padded.nii
adds two voxels padding to the left and posterior sides, and four slices to the bottom of the image. Note that the first argument changes the location of voxel (0,0,0) and thus the origin of the output image will be changed to maintain anatomical alignment between the padded and original images.
Normally you will want to pad with zeros, but you can pad with any constant value, eg :
c3d img1.nii -pad 10% 10% 1 -o padded.nii
Adds 10% to all sides of the image, and fills the new voxels with the value 1.
-pad: Pad image with constant value
Syntax: -pad <padlower> <padupper> <value>
Pads the image by a given percentage or number of voxels. The padlower dimension pads along the zero faces of the image, and the padupper dimension pads along the upper faces of the image. For example to add 1 voxel to the left side of an image, do
c3d img1.nii -pad 1x0x0vox 0x0x0vox 0 -o padded.nii
while
c3d img1.nii -pad 2x2x4vox 0% 0 -o padded.nii
adds two voxels padding to the left and posterior sides, and four slices to the bottom of the image. Note that the first argument changes the location of voxel (0,0,0) and thus the origin of the output image will be changed to maintain anatomical alignment between the padded and original images.
Normally you will want to pad with zeros, but you can pad with any constant value, eg :
c3d img1.nii -pad 10% 10% 1 -o padded.nii
Adds 10% to all sides of the image, and fills the new voxels with the value 1.
5184 def run( 5185 self, 5186 execution: Execution, 5187 ) -> list[str]: 5188 """ 5189 Build command line arguments. This method is called by the main command. 5190 5191 Args: 5192 execution: The execution object. 5193 Returns: 5194 Command line arguments 5195 """ 5196 cargs = [] 5197 cargs.extend([ 5198 "-pad", 5199 self.pad 5200 ]) 5201 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5204@dataclasses.dataclass 5205class C3dPadTo: 5206 """ 5207 No description found. 5208 """ 5209 pad_to: str 5210 """No description found.""" 5211 5212 def run( 5213 self, 5214 execution: Execution, 5215 ) -> list[str]: 5216 """ 5217 Build command line arguments. This method is called by the main command. 5218 5219 Args: 5220 execution: The execution object. 5221 Returns: 5222 Command line arguments 5223 """ 5224 cargs = [] 5225 cargs.extend([ 5226 "-padto", 5227 self.pad_to 5228 ]) 5229 return cargs
No description found.
5212 def run( 5213 self, 5214 execution: Execution, 5215 ) -> list[str]: 5216 """ 5217 Build command line arguments. This method is called by the main command. 5218 5219 Args: 5220 execution: The execution object. 5221 Returns: 5222 Command line arguments 5223 """ 5224 cargs = [] 5225 cargs.extend([ 5226 "-padto", 5227 self.pad_to 5228 ]) 5229 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5232@dataclasses.dataclass 5233class C3dPca: 5234 """ 5235 -pca: Principal components analysis of foreground voxels 5236 5237 Syntax: `-pca` 5238 5239 Similar to the *-centroid* command, computes the centroid and prinicipal 5240 components of the foregrond voxels in the image. For example if the image is 5241 a binary image of an ellipsoid, this will report the center and the 5242 principal axes of the ellipsoid, in physical NIFTI coordinates. 5243 5244 c3d binaryimage.img -pca // centroid of all non-0 voxels 5245 c3d labelimage.img -thresh 5 5 1 0 -pca // centroid of all voxels with label 5246 5 5247 c3d labelimage.img -split -foreach -pca -endfor // centroids of all labels 5248 (including 0). 5249 """ 5250 pca: str 5251 """-pca: Principal components analysis of foreground voxels 5252 5253 Syntax: `-pca` 5254 5255 Similar to the *-centroid* command, computes the centroid and prinicipal 5256 components of the foregrond voxels in the image. For example if the image is 5257 a binary image of an ellipsoid, this will report the center and the 5258 principal axes of the ellipsoid, in physical NIFTI coordinates. 5259 5260 c3d binaryimage.img -pca // centroid of all non-0 voxels 5261 c3d labelimage.img -thresh 5 5 1 0 -pca // centroid of all voxels with label 5262 5 5263 c3d labelimage.img -split -foreach -pca -endfor // centroids of all labels 5264 (including 0)""" 5265 5266 def run( 5267 self, 5268 execution: Execution, 5269 ) -> list[str]: 5270 """ 5271 Build command line arguments. This method is called by the main command. 5272 5273 Args: 5274 execution: The execution object. 5275 Returns: 5276 Command line arguments 5277 """ 5278 cargs = [] 5279 cargs.extend([ 5280 "-pca", 5281 self.pca 5282 ]) 5283 return cargs
-pca: Principal components analysis of foreground voxels
Syntax: -pca
Similar to the -centroid command, computes the centroid and prinicipal components of the foregrond voxels in the image. For example if the image is a binary image of an ellipsoid, this will report the center and the principal axes of the ellipsoid, in physical NIFTI coordinates.
c3d binaryimage.img -pca // centroid of all non-0 voxels c3d labelimage.img -thresh 5 5 1 0 -pca // centroid of all voxels with label 5 c3d labelimage.img -split -foreach -pca -endfor // centroids of all labels (including 0).
-pca: Principal components analysis of foreground voxels
Syntax: -pca
Similar to the -centroid command, computes the centroid and prinicipal components of the foregrond voxels in the image. For example if the image is a binary image of an ellipsoid, this will report the center and the principal axes of the ellipsoid, in physical NIFTI coordinates.
c3d binaryimage.img -pca // centroid of all non-0 voxels c3d labelimage.img -thresh 5 5 1 0 -pca // centroid of all voxels with label 5 c3d labelimage.img -split -foreach -pca -endfor // centroids of all labels (including 0)
5266 def run( 5267 self, 5268 execution: Execution, 5269 ) -> list[str]: 5270 """ 5271 Build command line arguments. This method is called by the main command. 5272 5273 Args: 5274 execution: The execution object. 5275 Returns: 5276 Command line arguments 5277 """ 5278 cargs = [] 5279 cargs.extend([ 5280 "-pca", 5281 self.pca 5282 ]) 5283 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5286@dataclasses.dataclass 5287class C3dPercentIntensityMode: 5288 """ 5289 -pim, -percent-intensity-mode: Set behavior of % specifier 5290 5291 Syntax: `-pim Quantile | q | ForegroundQuantile | fq | Range | r` 5292 5293 This options changes how the percent sign (%) is interpreted when specifying 5294 intensity values. **Quantile (q)** means that `10%` describes the 10th 5295 percentile of all intensity values in the image (i.e., 10% of the voxels 5296 have lower intensity). **ForegroundQuantile (fq)** is similar, but voxels 5297 with background intensity (see **-background** option) are excluded from the 5298 percentile computation. **Range (r)** changes the meaning of percent sign 5299 from percentile to the range between the minimum and maximum of the image, 5300 and `0.1%` becomes equal to MIN + 0.1 (MAX - MIN). The default is 5301 **Quantile**. 5302 5303 $ c3d comp01.png -verbose -pim Quantile -verbose -threshold 75% inf 1 0 5304 Quantile 0.75 maps to 18 5305 5306 $ c3d comp01.png -verbose -pim ForegroundQuantile -verbose -threshold 75% 5307 inf 1 0 5308 Foreground quantile 0.75 (over 37467 voxels) maps to 58 5309 5310 $ c3d comp01.png -verbose -pim Range -verbose -threshold 75% inf 1 0 5311 Intensity range spec 0.75 maps to 191.25. 5312 """ 5313 percent_intensity_mode: str 5314 """-pim, -percent-intensity-mode: Set behavior of % specifier 5315 5316 Syntax: `-pim Quantile | q | ForegroundQuantile | fq | Range | r` 5317 5318 This options changes how the percent sign (%) is interpreted when specifying 5319 intensity values. **Quantile (q)** means that `10%` describes the 10th 5320 percentile of all intensity values in the image (i.e., 10% of the voxels 5321 have lower intensity). **ForegroundQuantile (fq)** is similar, but voxels 5322 with background intensity (see **-background** option) are excluded from the 5323 percentile computation. **Range (r)** changes the meaning of percent sign 5324 from percentile to the range between the minimum and maximum of the image, 5325 and `0.1%` becomes equal to MIN + 0.1 (MAX - MIN). The default is 5326 **Quantile**. 5327 5328 $ c3d comp01.png -verbose -pim Quantile -verbose -threshold 75% inf 1 0 5329 Quantile 0.75 maps to 18 5330 5331 $ c3d comp01.png -verbose -pim ForegroundQuantile -verbose -threshold 75% 5332 inf 1 0 5333 Foreground quantile 0.75 (over 37467 voxels) maps to 58 5334 5335 $ c3d comp01.png -verbose -pim Range -verbose -threshold 75% inf 1 0 5336 Intensity range spec 0.75 maps to 191.25""" 5337 5338 def run( 5339 self, 5340 execution: Execution, 5341 ) -> list[str]: 5342 """ 5343 Build command line arguments. This method is called by the main command. 5344 5345 Args: 5346 execution: The execution object. 5347 Returns: 5348 Command line arguments 5349 """ 5350 cargs = [] 5351 cargs.extend([ 5352 "-percent-intensity-mode", 5353 self.percent_intensity_mode 5354 ]) 5355 return cargs
-pim, -percent-intensity-mode: Set behavior of % specifier
Syntax: -pim Quantile | q | ForegroundQuantile | fq | Range | r
This options changes how the percent sign (%) is interpreted when specifying
intensity values. Quantile (q) means that 10% describes the 10th
percentile of all intensity values in the image (i.e., 10% of the voxels
have lower intensity). ForegroundQuantile (fq) is similar, but voxels
with background intensity (see -background option) are excluded from the
percentile computation. Range (r) changes the meaning of percent sign
from percentile to the range between the minimum and maximum of the image,
and 0.1% becomes equal to MIN + 0.1 (MAX - MIN). The default is
Quantile.
$ c3d comp01.png -verbose -pim Quantile -verbose -threshold 75% inf 1 0 Quantile 0.75 maps to 18
$ c3d comp01.png -verbose -pim ForegroundQuantile -verbose -threshold 75% inf 1 0 Foreground quantile 0.75 (over 37467 voxels) maps to 58
$ c3d comp01.png -verbose -pim Range -verbose -threshold 75% inf 1 0 Intensity range spec 0.75 maps to 191.25.
-pim, -percent-intensity-mode: Set behavior of % specifier
Syntax: -pim Quantile | q | ForegroundQuantile | fq | Range | r
This options changes how the percent sign (%) is interpreted when specifying
intensity values. Quantile (q) means that 10% describes the 10th
percentile of all intensity values in the image (i.e., 10% of the voxels
have lower intensity). ForegroundQuantile (fq) is similar, but voxels
with background intensity (see -background option) are excluded from the
percentile computation. Range (r) changes the meaning of percent sign
from percentile to the range between the minimum and maximum of the image,
and 0.1% becomes equal to MIN + 0.1 (MAX - MIN). The default is
Quantile.
$ c3d comp01.png -verbose -pim Quantile -verbose -threshold 75% inf 1 0 Quantile 0.75 maps to 18
$ c3d comp01.png -verbose -pim ForegroundQuantile -verbose -threshold 75% inf 1 0 Foreground quantile 0.75 (over 37467 voxels) maps to 58
$ c3d comp01.png -verbose -pim Range -verbose -threshold 75% inf 1 0 Intensity range spec 0.75 maps to 191.25
5338 def run( 5339 self, 5340 execution: Execution, 5341 ) -> list[str]: 5342 """ 5343 Build command line arguments. This method is called by the main command. 5344 5345 Args: 5346 execution: The execution object. 5347 Returns: 5348 Command line arguments 5349 """ 5350 cargs = [] 5351 cargs.extend([ 5352 "-percent-intensity-mode", 5353 self.percent_intensity_mode 5354 ]) 5355 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5358@dataclasses.dataclass 5359class C3dPixel: 5360 """ 5361 No description found. 5362 """ 5363 pixel: str 5364 """No description found.""" 5365 5366 def run( 5367 self, 5368 execution: Execution, 5369 ) -> list[str]: 5370 """ 5371 Build command line arguments. This method is called by the main command. 5372 5373 Args: 5374 execution: The execution object. 5375 Returns: 5376 Command line arguments 5377 """ 5378 cargs = [] 5379 cargs.extend([ 5380 "-pixel", 5381 self.pixel 5382 ]) 5383 return cargs
No description found.
5366 def run( 5367 self, 5368 execution: Execution, 5369 ) -> list[str]: 5370 """ 5371 Build command line arguments. This method is called by the main command. 5372 5373 Args: 5374 execution: The execution object. 5375 Returns: 5376 Command line arguments 5377 """ 5378 cargs = [] 5379 cargs.extend([ 5380 "-pixel", 5381 self.pixel 5382 ]) 5383 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5386@dataclasses.dataclass 5387class C3dPop: 5388 """ 5389 -pop: Remove last image from the stack 5390 5391 Syntax: `-pop` 5392 5393 Removes the last image from the image stack. Images assigned a name with the 5394 **-as** command will remain in memory. 5395 """ 5396 pop_: str 5397 """-pop: Remove last image from the stack 5398 5399 Syntax: `-pop` 5400 5401 Removes the last image from the image stack. Images assigned a name with the 5402 **-as** command will remain in memory.""" 5403 5404 def run( 5405 self, 5406 execution: Execution, 5407 ) -> list[str]: 5408 """ 5409 Build command line arguments. This method is called by the main command. 5410 5411 Args: 5412 execution: The execution object. 5413 Returns: 5414 Command line arguments 5415 """ 5416 cargs = [] 5417 cargs.extend([ 5418 "-pop", 5419 self.pop_ 5420 ]) 5421 return cargs
-pop: Remove last image from the stack
Syntax: -pop
Removes the last image from the image stack. Images assigned a name with the -as command will remain in memory.
-pop: Remove last image from the stack
Syntax: -pop
Removes the last image from the image stack. Images assigned a name with the -as command will remain in memory.
5404 def run( 5405 self, 5406 execution: Execution, 5407 ) -> list[str]: 5408 """ 5409 Build command line arguments. This method is called by the main command. 5410 5411 Args: 5412 execution: The execution object. 5413 Returns: 5414 Command line arguments 5415 """ 5416 cargs = [] 5417 cargs.extend([ 5418 "-pop", 5419 self.pop_ 5420 ]) 5421 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5424@dataclasses.dataclass 5425class C3dPopas: 5426 """ 5427 -popas: Remove last image from the stack and assign to variable 5428 5429 Syntax: `-popas var` 5430 5431 Removes the last image from the stack, but also assigns it the name 'var', 5432 keeping the image in memory. Same as calling **-as** *var* followed by 5433 **-pop**. 5434 """ 5435 popas: str 5436 """-popas: Remove last image from the stack and assign to variable 5437 5438 Syntax: `-popas var` 5439 5440 Removes the last image from the stack, but also assigns it the name 'var', 5441 keeping the image in memory. Same as calling **-as** *var* followed by 5442 **-pop**.""" 5443 5444 def run( 5445 self, 5446 execution: Execution, 5447 ) -> list[str]: 5448 """ 5449 Build command line arguments. This method is called by the main command. 5450 5451 Args: 5452 execution: The execution object. 5453 Returns: 5454 Command line arguments 5455 """ 5456 cargs = [] 5457 cargs.extend([ 5458 "-popas", 5459 self.popas 5460 ]) 5461 return cargs
-popas: Remove last image from the stack and assign to variable
Syntax: -popas var
Removes the last image from the stack, but also assigns it the name 'var', keeping the image in memory. Same as calling -as var followed by -pop.
-popas: Remove last image from the stack and assign to variable
Syntax: -popas var
Removes the last image from the stack, but also assigns it the name 'var', keeping the image in memory. Same as calling -as var followed by -pop.
5444 def run( 5445 self, 5446 execution: Execution, 5447 ) -> list[str]: 5448 """ 5449 Build command line arguments. This method is called by the main command. 5450 5451 Args: 5452 execution: The execution object. 5453 Returns: 5454 Command line arguments 5455 """ 5456 cargs = [] 5457 cargs.extend([ 5458 "-popas", 5459 self.popas 5460 ]) 5461 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5464@dataclasses.dataclass 5465class C3dProbe: 5466 """ 5467 -probe: Report image intensity at a voxel 5468 5469 Syntax: `-probe <point_spec>` 5470 5471 Prints the value of the image at the position specified by the parameter 5472 `point_spec`, which may be in physical units or voxel units: 5473 5474 c3d img1.img -probe 128x120x160vox 5475 c3d img1.img -interpolation NearestNeighbor -probe 60x60x60mm 5476 c3d img1.img -probe 50%. 5477 """ 5478 probe: str 5479 """-probe: Report image intensity at a voxel 5480 5481 Syntax: `-probe <point_spec>` 5482 5483 Prints the value of the image at the position specified by the parameter 5484 `point_spec`, which may be in physical units or voxel units: 5485 5486 c3d img1.img -probe 128x120x160vox 5487 c3d img1.img -interpolation NearestNeighbor -probe 60x60x60mm 5488 c3d img1.img -probe 50%""" 5489 5490 def run( 5491 self, 5492 execution: Execution, 5493 ) -> list[str]: 5494 """ 5495 Build command line arguments. This method is called by the main command. 5496 5497 Args: 5498 execution: The execution object. 5499 Returns: 5500 Command line arguments 5501 """ 5502 cargs = [] 5503 cargs.extend([ 5504 "-probe", 5505 self.probe 5506 ]) 5507 return cargs
-probe: Report image intensity at a voxel
Syntax: -probe <point_spec>
Prints the value of the image at the position specified by the parameter
point_spec, which may be in physical units or voxel units:
c3d img1.img -probe 128x120x160vox c3d img1.img -interpolation NearestNeighbor -probe 60x60x60mm c3d img1.img -probe 50%.
-probe: Report image intensity at a voxel
Syntax: -probe <point_spec>
Prints the value of the image at the position specified by the parameter
point_spec, which may be in physical units or voxel units:
c3d img1.img -probe 128x120x160vox c3d img1.img -interpolation NearestNeighbor -probe 60x60x60mm c3d img1.img -probe 50%
5490 def run( 5491 self, 5492 execution: Execution, 5493 ) -> list[str]: 5494 """ 5495 Build command line arguments. This method is called by the main command. 5496 5497 Args: 5498 execution: The execution object. 5499 Returns: 5500 Command line arguments 5501 """ 5502 cargs = [] 5503 cargs.extend([ 5504 "-probe", 5505 self.probe 5506 ]) 5507 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5510@dataclasses.dataclass 5511class C3dPush: 5512 """ 5513 -push: Place variable at the end of the stack 5514 5515 Syntax: `-push var` 5516 5517 Places the image associated with variable name 'var' on end of the image 5518 stack. Variable names are assigned using the **-as** command. The **-as** 5519 and **-push** commands are useful when you need to use a certain image more 5520 than once during a convert3d operation. For example, if you want to compute 5521 the distance transform of a binary image and mask it so that the values 5522 outside of the binary image region have value 0, you would use the following 5523 command: 5524 5525 c3d binary.img -as A -sdt -push A -times -o masked_distance.img. 5526 """ 5527 push: str 5528 """-push: Place variable at the end of the stack 5529 5530 Syntax: `-push var` 5531 5532 Places the image associated with variable name 'var' on end of the image 5533 stack. Variable names are assigned using the **-as** command. The **-as** 5534 and **-push** commands are useful when you need to use a certain image more 5535 than once during a convert3d operation. For example, if you want to compute 5536 the distance transform of a binary image and mask it so that the values 5537 outside of the binary image region have value 0, you would use the following 5538 command: 5539 5540 c3d binary.img -as A -sdt -push A -times -o masked_distance.img""" 5541 5542 def run( 5543 self, 5544 execution: Execution, 5545 ) -> list[str]: 5546 """ 5547 Build command line arguments. This method is called by the main command. 5548 5549 Args: 5550 execution: The execution object. 5551 Returns: 5552 Command line arguments 5553 """ 5554 cargs = [] 5555 cargs.extend([ 5556 "-push", 5557 self.push 5558 ]) 5559 return cargs
-push: Place variable at the end of the stack
Syntax: -push var
Places the image associated with variable name 'var' on end of the image stack. Variable names are assigned using the -as command. The -as and -push commands are useful when you need to use a certain image more than once during a convert3d operation. For example, if you want to compute the distance transform of a binary image and mask it so that the values outside of the binary image region have value 0, you would use the following command:
c3d binary.img -as A -sdt -push A -times -o masked_distance.img.
-push: Place variable at the end of the stack
Syntax: -push var
Places the image associated with variable name 'var' on end of the image stack. Variable names are assigned using the -as command. The -as and -push commands are useful when you need to use a certain image more than once during a convert3d operation. For example, if you want to compute the distance transform of a binary image and mask it so that the values outside of the binary image region have value 0, you would use the following command:
c3d binary.img -as A -sdt -push A -times -o masked_distance.img
5542 def run( 5543 self, 5544 execution: Execution, 5545 ) -> list[str]: 5546 """ 5547 Build command line arguments. This method is called by the main command. 5548 5549 Args: 5550 execution: The execution object. 5551 Returns: 5552 Command line arguments 5553 """ 5554 cargs = [] 5555 cargs.extend([ 5556 "-push", 5557 self.push 5558 ]) 5559 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5562@dataclasses.dataclass 5563class C3dRank: 5564 """ 5565 -rank: Voxelwise ranking of intensity values 5566 5567 Syntax: `-rank ` 5568 5569 This command takes N images as the input (all the images on the stack are 5570 used). It also generates N images as the output. For voxel k in image j, it 5571 assigns it a label based on its rank among the values of voxel k in all N 5572 images. If the voxel has highest intensity in image j, then the j'th output 5573 will have value 1. 5574 5575 c3d img1.img img2.img ... imgN.img -rank -oo rank%d.img. 5576 """ 5577 rank: str 5578 """-rank: Voxelwise ranking of intensity values 5579 5580 Syntax: `-rank ` 5581 5582 This command takes N images as the input (all the images on the stack are 5583 used). It also generates N images as the output. For voxel k in image j, it 5584 assigns it a label based on its rank among the values of voxel k in all N 5585 images. If the voxel has highest intensity in image j, then the j'th output 5586 will have value 1. 5587 5588 c3d img1.img img2.img ... imgN.img -rank -oo rank%d.img""" 5589 5590 def run( 5591 self, 5592 execution: Execution, 5593 ) -> list[str]: 5594 """ 5595 Build command line arguments. This method is called by the main command. 5596 5597 Args: 5598 execution: The execution object. 5599 Returns: 5600 Command line arguments 5601 """ 5602 cargs = [] 5603 cargs.extend([ 5604 "-rank", 5605 self.rank 5606 ]) 5607 return cargs
-rank: Voxelwise ranking of intensity values
Syntax: -rank
This command takes N images as the input (all the images on the stack are used). It also generates N images as the output. For voxel k in image j, it assigns it a label based on its rank among the values of voxel k in all N images. If the voxel has highest intensity in image j, then the j'th output will have value 1.
c3d img1.img img2.img ... imgN.img -rank -oo rank%d.img.
-rank: Voxelwise ranking of intensity values
Syntax: -rank
This command takes N images as the input (all the images on the stack are used). It also generates N images as the output. For voxel k in image j, it assigns it a label based on its rank among the values of voxel k in all N images. If the voxel has highest intensity in image j, then the j'th output will have value 1.
c3d img1.img img2.img ... imgN.img -rank -oo rank%d.img
5590 def run( 5591 self, 5592 execution: Execution, 5593 ) -> list[str]: 5594 """ 5595 Build command line arguments. This method is called by the main command. 5596 5597 Args: 5598 execution: The execution object. 5599 Returns: 5600 Command line arguments 5601 """ 5602 cargs = [] 5603 cargs.extend([ 5604 "-rank", 5605 self.rank 5606 ]) 5607 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5610@dataclasses.dataclass 5611class C3dReciprocal: 5612 """ 5613 -reciprocal: Image voxelwise reciprocal 5614 5615 Syntax: `-reciprocal ` 5616 5617 Computes the reciprocal of an image. For instance to compute B = 1 / A, use 5618 the command 5619 5620 c3d A.img -reciprocal -o B.img. 5621 """ 5622 reciprocal: str 5623 """-reciprocal: Image voxelwise reciprocal 5624 5625 Syntax: `-reciprocal ` 5626 5627 Computes the reciprocal of an image. For instance to compute B = 1 / A, use 5628 the command 5629 5630 c3d A.img -reciprocal -o B.img""" 5631 5632 def run( 5633 self, 5634 execution: Execution, 5635 ) -> list[str]: 5636 """ 5637 Build command line arguments. This method is called by the main command. 5638 5639 Args: 5640 execution: The execution object. 5641 Returns: 5642 Command line arguments 5643 """ 5644 cargs = [] 5645 cargs.extend([ 5646 "-reciprocal", 5647 self.reciprocal 5648 ]) 5649 return cargs
-reciprocal: Image voxelwise reciprocal
Syntax: -reciprocal
Computes the reciprocal of an image. For instance to compute B = 1 / A, use the command
c3d A.img -reciprocal -o B.img.
-reciprocal: Image voxelwise reciprocal
Syntax: -reciprocal
Computes the reciprocal of an image. For instance to compute B = 1 / A, use the command
c3d A.img -reciprocal -o B.img
5632 def run( 5633 self, 5634 execution: Execution, 5635 ) -> list[str]: 5636 """ 5637 Build command line arguments. This method is called by the main command. 5638 5639 Args: 5640 execution: The execution object. 5641 Returns: 5642 Command line arguments 5643 """ 5644 cargs = [] 5645 cargs.extend([ 5646 "-reciprocal", 5647 self.reciprocal 5648 ]) 5649 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5652@dataclasses.dataclass 5653class C3dRegion: 5654 """ 5655 -region: Extract region from image 5656 5657 Syntax: `-region vOrigin vSize ` 5658 5659 Extract a rectangular region from the image. The first parameter is the 5660 position of the corner of the region, and the second is the size of the 5661 region. 5662 5663 c3d img1.img -region 20x20x20vox 50x60x70vox -o img2.img 5664 c3d img1.img -region 25% 50% -o img3.img. 5665 """ 5666 region: str 5667 """-region: Extract region from image 5668 5669 Syntax: `-region vOrigin vSize ` 5670 5671 Extract a rectangular region from the image. The first parameter is the 5672 position of the corner of the region, and the second is the size of the 5673 region. 5674 5675 c3d img1.img -region 20x20x20vox 50x60x70vox -o img2.img 5676 c3d img1.img -region 25% 50% -o img3.img""" 5677 5678 def run( 5679 self, 5680 execution: Execution, 5681 ) -> list[str]: 5682 """ 5683 Build command line arguments. This method is called by the main command. 5684 5685 Args: 5686 execution: The execution object. 5687 Returns: 5688 Command line arguments 5689 """ 5690 cargs = [] 5691 cargs.extend([ 5692 "-region", 5693 self.region 5694 ]) 5695 return cargs
-region: Extract region from image
Syntax: -region vOrigin vSize
Extract a rectangular region from the image. The first parameter is the position of the corner of the region, and the second is the size of the region.
c3d img1.img -region 20x20x20vox 50x60x70vox -o img2.img c3d img1.img -region 25% 50% -o img3.img.
-region: Extract region from image
Syntax: -region vOrigin vSize
Extract a rectangular region from the image. The first parameter is the position of the corner of the region, and the second is the size of the region.
c3d img1.img -region 20x20x20vox 50x60x70vox -o img2.img c3d img1.img -region 25% 50% -o img3.img
5678 def run( 5679 self, 5680 execution: Execution, 5681 ) -> list[str]: 5682 """ 5683 Build command line arguments. This method is called by the main command. 5684 5685 Args: 5686 execution: The execution object. 5687 Returns: 5688 Command line arguments 5689 """ 5690 cargs = [] 5691 cargs.extend([ 5692 "-region", 5693 self.region 5694 ]) 5695 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5698@dataclasses.dataclass 5699class C3dReorder: 5700 """ 5701 -reorder: Rearrange images on the stack 5702 5703 Syntax: `-reorder k` or `-reorder fraction` 5704 5705 Rearranges images in the stack, such that images that are k positions apart 5706 become next to each other on the stack. In other words, if the original 5707 order of the images is 1, 2, ..., n, the new order of the images becomes 1, 5708 1+k, 1+2k, ..., 2, 2+k, 2+2k, ..., k, 2k, ... n. Of course, n must be 5709 divisible by k. As an alternative to specifying k, you can specify a 5710 floating point number (i.e., **-reorder** 0.5), in which case k is obtained 5711 by multiplying n by the floating point number and rounding to the nearest 5712 integer. 5713 5714 The following three commands are equivalent: 5715 5716 c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 4 ... 5717 c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 0.5 ... 5718 c3d a1.nii b1.nii a2.nii b2.nii a3.nii b3.nii a4.nii b4.nii ... 5719 5720 The **-reorder** command us useful when you specify two sets of images using 5721 wildcards and then want to perform pairwise operations on the images. For 5722 example 5723 5724 c3d weight*.nii gray*.nii -reorder 0.5 -weighted-sum-voxelwise -o wsum.nii 5725 5726 is equivalent to the command 5727 5728 c3d weight1.nii gray1.nii weight2.nii gray2.nii ... -weighted-sum-voxelwise 5729 -o wsum.nii. 5730 """ 5731 reorder: str 5732 """-reorder: Rearrange images on the stack 5733 5734 Syntax: `-reorder k` or `-reorder fraction` 5735 5736 Rearranges images in the stack, such that images that are k positions apart 5737 become next to each other on the stack. In other words, if the original 5738 order of the images is 1, 2, ..., n, the new order of the images becomes 1, 5739 1+k, 1+2k, ..., 2, 2+k, 2+2k, ..., k, 2k, ... n. Of course, n must be 5740 divisible by k. As an alternative to specifying k, you can specify a 5741 floating point number (i.e., **-reorder** 0.5), in which case k is obtained 5742 by multiplying n by the floating point number and rounding to the nearest 5743 integer. 5744 5745 The following three commands are equivalent: 5746 5747 c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 4 ... 5748 c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 0.5 ... 5749 c3d a1.nii b1.nii a2.nii b2.nii a3.nii b3.nii a4.nii b4.nii ... 5750 5751 The **-reorder** command us useful when you specify two sets of images using 5752 wildcards and then want to perform pairwise operations on the images. For 5753 example 5754 5755 c3d weight*.nii gray*.nii -reorder 0.5 -weighted-sum-voxelwise -o wsum.nii 5756 5757 is equivalent to the command 5758 5759 c3d weight1.nii gray1.nii weight2.nii gray2.nii ... -weighted-sum-voxelwise 5760 -o wsum.nii""" 5761 5762 def run( 5763 self, 5764 execution: Execution, 5765 ) -> list[str]: 5766 """ 5767 Build command line arguments. This method is called by the main command. 5768 5769 Args: 5770 execution: The execution object. 5771 Returns: 5772 Command line arguments 5773 """ 5774 cargs = [] 5775 cargs.extend([ 5776 "-reorder", 5777 self.reorder 5778 ]) 5779 return cargs
-reorder: Rearrange images on the stack
Syntax: -reorder k or -reorder fraction
Rearranges images in the stack, such that images that are k positions apart become next to each other on the stack. In other words, if the original order of the images is 1, 2, ..., n, the new order of the images becomes 1, 1+k, 1+2k, ..., 2, 2+k, 2+2k, ..., k, 2k, ... n. Of course, n must be divisible by k. As an alternative to specifying k, you can specify a floating point number (i.e., -reorder 0.5), in which case k is obtained by multiplying n by the floating point number and rounding to the nearest integer.
The following three commands are equivalent:
c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 4 ... c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 0.5 ... c3d a1.nii b1.nii a2.nii b2.nii a3.nii b3.nii a4.nii b4.nii ...
The -reorder command us useful when you specify two sets of images using wildcards and then want to perform pairwise operations on the images. For example
c3d weight.nii gray.nii -reorder 0.5 -weighted-sum-voxelwise -o wsum.nii
is equivalent to the command
c3d weight1.nii gray1.nii weight2.nii gray2.nii ... -weighted-sum-voxelwise -o wsum.nii.
-reorder: Rearrange images on the stack
Syntax: -reorder k or -reorder fraction
Rearranges images in the stack, such that images that are k positions apart become next to each other on the stack. In other words, if the original order of the images is 1, 2, ..., n, the new order of the images becomes 1, 1+k, 1+2k, ..., 2, 2+k, 2+2k, ..., k, 2k, ... n. Of course, n must be divisible by k. As an alternative to specifying k, you can specify a floating point number (i.e., -reorder 0.5), in which case k is obtained by multiplying n by the floating point number and rounding to the nearest integer.
The following three commands are equivalent:
c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 4 ... c3d a1.nii a2.nii a3.nii a4.nii b1.nii b2.nii b3.nii b4.nii -reorder 0.5 ... c3d a1.nii b1.nii a2.nii b2.nii a3.nii b3.nii a4.nii b4.nii ...
The -reorder command us useful when you specify two sets of images using wildcards and then want to perform pairwise operations on the images. For example
c3d weight.nii gray.nii -reorder 0.5 -weighted-sum-voxelwise -o wsum.nii
is equivalent to the command
c3d weight1.nii gray1.nii weight2.nii gray2.nii ... -weighted-sum-voxelwise -o wsum.nii
5762 def run( 5763 self, 5764 execution: Execution, 5765 ) -> list[str]: 5766 """ 5767 Build command line arguments. This method is called by the main command. 5768 5769 Args: 5770 execution: The execution object. 5771 Returns: 5772 Command line arguments 5773 """ 5774 cargs = [] 5775 cargs.extend([ 5776 "-reorder", 5777 self.reorder 5778 ]) 5779 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6216@dataclasses.dataclass 6217class C3dReplace: 6218 """ 6219 -replace: Replace intensities in image 6220 6221 Syntax: `-replace I1 J1 I2 J2 ... ` 6222 6223 Replace intensity I1 by J1, I2 by J2 and so on. Allowed values of intensity 6224 include **nan**, **inf** and **-inf**. 6225 6226 c3d img1.img -replace 1 128 nan 0.0 -o img2.img. 6227 """ 6228 replace: str 6229 """-replace: Replace intensities in image 6230 6231 Syntax: `-replace I1 J1 I2 J2 ... ` 6232 6233 Replace intensity I1 by J1, I2 by J2 and so on. Allowed values of intensity 6234 include **nan**, **inf** and **-inf**. 6235 6236 c3d img1.img -replace 1 128 nan 0.0 -o img2.img""" 6237 6238 def run( 6239 self, 6240 execution: Execution, 6241 ) -> list[str]: 6242 """ 6243 Build command line arguments. This method is called by the main command. 6244 6245 Args: 6246 execution: The execution object. 6247 Returns: 6248 Command line arguments 6249 """ 6250 cargs = [] 6251 cargs.extend([ 6252 "-replace", 6253 self.replace 6254 ]) 6255 return cargs
-replace: Replace intensities in image
Syntax: -replace I1 J1 I2 J2 ...
Replace intensity I1 by J1, I2 by J2 and so on. Allowed values of intensity include nan, inf and -inf.
c3d img1.img -replace 1 128 nan 0.0 -o img2.img.
-replace: Replace intensities in image
Syntax: -replace I1 J1 I2 J2 ...
Replace intensity I1 by J1, I2 by J2 and so on. Allowed values of intensity include nan, inf and -inf.
c3d img1.img -replace 1 128 nan 0.0 -o img2.img
6238 def run( 6239 self, 6240 execution: Execution, 6241 ) -> list[str]: 6242 """ 6243 Build command line arguments. This method is called by the main command. 6244 6245 Args: 6246 execution: The execution object. 6247 Returns: 6248 Command line arguments 6249 """ 6250 cargs = [] 6251 cargs.extend([ 6252 "-replace", 6253 self.replace 6254 ]) 6255 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6258@dataclasses.dataclass 6259class C3dResample: 6260 """ 6261 -resample: Resample image to new dimensions 6262 6263 Syntax: `-resample <dimensions> ` 6264 6265 Resamples the image, keeping the bounding box the same, but changing the 6266 number of voxels in the image. The dimensions can be specified as a 6267 percentage, for example to double the number of voxels in each direction. 6268 The **-interpolation** flag affects how sampling is performed. 6269 6270 c3d img1.img -resample 123x142x200 -o img2.img 6271 c3d img1.img -resample 200% -o img2.img 6272 c3d img1.img -resample 100x100x200% -o img2.img 6273 c3d img1.img -background 4.0 -interpolation Cubic -resample 123x142x200 -o 6274 img2.img. 6275 """ 6276 resample: str 6277 """-resample: Resample image to new dimensions 6278 6279 Syntax: `-resample <dimensions> ` 6280 6281 Resamples the image, keeping the bounding box the same, but changing the 6282 number of voxels in the image. The dimensions can be specified as a 6283 percentage, for example to double the number of voxels in each direction. 6284 The **-interpolation** flag affects how sampling is performed. 6285 6286 c3d img1.img -resample 123x142x200 -o img2.img 6287 c3d img1.img -resample 200% -o img2.img 6288 c3d img1.img -resample 100x100x200% -o img2.img 6289 c3d img1.img -background 4.0 -interpolation Cubic -resample 123x142x200 -o 6290 img2.img""" 6291 6292 def run( 6293 self, 6294 execution: Execution, 6295 ) -> list[str]: 6296 """ 6297 Build command line arguments. This method is called by the main command. 6298 6299 Args: 6300 execution: The execution object. 6301 Returns: 6302 Command line arguments 6303 """ 6304 cargs = [] 6305 cargs.extend([ 6306 "-resample", 6307 self.resample 6308 ]) 6309 return cargs
-resample: Resample image to new dimensions
Syntax: -resample <dimensions>
Resamples the image, keeping the bounding box the same, but changing the number of voxels in the image. The dimensions can be specified as a percentage, for example to double the number of voxels in each direction. The -interpolation flag affects how sampling is performed.
c3d img1.img -resample 123x142x200 -o img2.img c3d img1.img -resample 200% -o img2.img c3d img1.img -resample 100x100x200% -o img2.img c3d img1.img -background 4.0 -interpolation Cubic -resample 123x142x200 -o img2.img.
-resample: Resample image to new dimensions
Syntax: -resample <dimensions>
Resamples the image, keeping the bounding box the same, but changing the number of voxels in the image. The dimensions can be specified as a percentage, for example to double the number of voxels in each direction. The -interpolation flag affects how sampling is performed.
c3d img1.img -resample 123x142x200 -o img2.img c3d img1.img -resample 200% -o img2.img c3d img1.img -resample 100x100x200% -o img2.img c3d img1.img -background 4.0 -interpolation Cubic -resample 123x142x200 -o img2.img
6292 def run( 6293 self, 6294 execution: Execution, 6295 ) -> list[str]: 6296 """ 6297 Build command line arguments. This method is called by the main command. 6298 6299 Args: 6300 execution: The execution object. 6301 Returns: 6302 Command line arguments 6303 """ 6304 cargs = [] 6305 cargs.extend([ 6306 "-resample", 6307 self.resample 6308 ]) 6309 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6312@dataclasses.dataclass 6313class C3dResampleIso: 6314 """ 6315 -resample-iso: Resample image to (approximately) isotropic resolution 6316 6317 Syntax: `-resample-iso <min|max>` 6318 6319 Resamples the image to have approximately isotropic resolution, either based 6320 on the smallest voxel dimension ('min' mode) or largest voxel dimension 6321 ('max' mode). This command calls **-resample** with appropriately calculated 6322 new image dimensions. The bounding box of the image in physical space is 6323 preserved. Therefore, since the image dimensions must be integer, the actual 6324 voxel dimensions after resampling may not be precisely isotropic. 6325 6326 c3d img1.img -resample-iso min -o img2.img. 6327 """ 6328 resample_iso: str 6329 """-resample-iso: Resample image to (approximately) isotropic resolution 6330 6331 Syntax: `-resample-iso <min|max>` 6332 6333 Resamples the image to have approximately isotropic resolution, either based 6334 on the smallest voxel dimension ('min' mode) or largest voxel dimension 6335 ('max' mode). This command calls **-resample** with appropriately calculated 6336 new image dimensions. The bounding box of the image in physical space is 6337 preserved. Therefore, since the image dimensions must be integer, the actual 6338 voxel dimensions after resampling may not be precisely isotropic. 6339 6340 c3d img1.img -resample-iso min -o img2.img""" 6341 6342 def run( 6343 self, 6344 execution: Execution, 6345 ) -> list[str]: 6346 """ 6347 Build command line arguments. This method is called by the main command. 6348 6349 Args: 6350 execution: The execution object. 6351 Returns: 6352 Command line arguments 6353 """ 6354 cargs = [] 6355 cargs.extend([ 6356 "-resample-iso", 6357 self.resample_iso 6358 ]) 6359 return cargs
-resample-iso: Resample image to (approximately) isotropic resolution
Syntax: -resample-iso <min|max>
Resamples the image to have approximately isotropic resolution, either based on the smallest voxel dimension ('min' mode) or largest voxel dimension ('max' mode). This command calls -resample with appropriately calculated new image dimensions. The bounding box of the image in physical space is preserved. Therefore, since the image dimensions must be integer, the actual voxel dimensions after resampling may not be precisely isotropic.
c3d img1.img -resample-iso min -o img2.img.
-resample-iso: Resample image to (approximately) isotropic resolution
Syntax: -resample-iso <min|max>
Resamples the image to have approximately isotropic resolution, either based on the smallest voxel dimension ('min' mode) or largest voxel dimension ('max' mode). This command calls -resample with appropriately calculated new image dimensions. The bounding box of the image in physical space is preserved. Therefore, since the image dimensions must be integer, the actual voxel dimensions after resampling may not be precisely isotropic.
c3d img1.img -resample-iso min -o img2.img
6342 def run( 6343 self, 6344 execution: Execution, 6345 ) -> list[str]: 6346 """ 6347 Build command line arguments. This method is called by the main command. 6348 6349 Args: 6350 execution: The execution object. 6351 Returns: 6352 Command line arguments 6353 """ 6354 cargs = [] 6355 cargs.extend([ 6356 "-resample-iso", 6357 self.resample_iso 6358 ]) 6359 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6362@dataclasses.dataclass 6363class C3dResampleMm: 6364 """ 6365 -resample-mm: Resample image to new resolution 6366 6367 Syntax: `-resample-mm <voxel_size> ` 6368 6369 Resamples the image as in **-resample**, but the user specifies the new 6370 voxel size rather than dimensions. This may not be precise, so the bounding 6371 box of the image may change. A warning will be generated in that case. 6372 6373 c3d img1.img -resample-mm 1.0x1.5x1.5mm -o img2.img. 6374 """ 6375 resample_mm: str 6376 """-resample-mm: Resample image to new resolution 6377 6378 Syntax: `-resample-mm <voxel_size> ` 6379 6380 Resamples the image as in **-resample**, but the user specifies the new 6381 voxel size rather than dimensions. This may not be precise, so the bounding 6382 box of the image may change. A warning will be generated in that case. 6383 6384 c3d img1.img -resample-mm 1.0x1.5x1.5mm -o img2.img""" 6385 6386 def run( 6387 self, 6388 execution: Execution, 6389 ) -> list[str]: 6390 """ 6391 Build command line arguments. This method is called by the main command. 6392 6393 Args: 6394 execution: The execution object. 6395 Returns: 6396 Command line arguments 6397 """ 6398 cargs = [] 6399 cargs.extend([ 6400 "-resample-mm", 6401 self.resample_mm 6402 ]) 6403 return cargs
-resample-mm: Resample image to new resolution
Syntax: -resample-mm <voxel_size>
Resamples the image as in -resample, but the user specifies the new voxel size rather than dimensions. This may not be precise, so the bounding box of the image may change. A warning will be generated in that case.
c3d img1.img -resample-mm 1.0x1.5x1.5mm -o img2.img.
-resample-mm: Resample image to new resolution
Syntax: -resample-mm <voxel_size>
Resamples the image as in -resample, but the user specifies the new voxel size rather than dimensions. This may not be precise, so the bounding box of the image may change. A warning will be generated in that case.
c3d img1.img -resample-mm 1.0x1.5x1.5mm -o img2.img
6386 def run( 6387 self, 6388 execution: Execution, 6389 ) -> list[str]: 6390 """ 6391 Build command line arguments. This method is called by the main command. 6392 6393 Args: 6394 execution: The execution object. 6395 Returns: 6396 Command line arguments 6397 """ 6398 cargs = [] 6399 cargs.extend([ 6400 "-resample-mm", 6401 self.resample_mm 6402 ]) 6403 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6472@dataclasses.dataclass 6473class C3dResliceIdentity: 6474 """ 6475 -reslice-identity: Resample image using identity transform 6476 6477 Syntax: `-reslice-identity ` 6478 6479 Applies the **-reslice-matrix** command with the identity transform. This is 6480 useful when you have two scans of the same subject with different coordinate 6481 transformations to patient space and you want to resample one scan in the 6482 space of another scan. For example, if you have T1 and T2 images in 6483 different coordinate frames, and want to reslice the T2 image into the space 6484 of the T1 6485 6486 c3d t1.nii t2.nii -reslice-identity -o t2_in_t1_space.nii. 6487 """ 6488 reslice_identity: str 6489 """-reslice-identity: Resample image using identity transform 6490 6491 Syntax: `-reslice-identity ` 6492 6493 Applies the **-reslice-matrix** command with the identity transform. This is 6494 useful when you have two scans of the same subject with different coordinate 6495 transformations to patient space and you want to resample one scan in the 6496 space of another scan. For example, if you have T1 and T2 images in 6497 different coordinate frames, and want to reslice the T2 image into the space 6498 of the T1 6499 6500 c3d t1.nii t2.nii -reslice-identity -o t2_in_t1_space.nii""" 6501 6502 def run( 6503 self, 6504 execution: Execution, 6505 ) -> list[str]: 6506 """ 6507 Build command line arguments. This method is called by the main command. 6508 6509 Args: 6510 execution: The execution object. 6511 Returns: 6512 Command line arguments 6513 """ 6514 cargs = [] 6515 cargs.extend([ 6516 "-reslice-identity", 6517 self.reslice_identity 6518 ]) 6519 return cargs
-reslice-identity: Resample image using identity transform
Syntax: -reslice-identity
Applies the -reslice-matrix command with the identity transform. This is useful when you have two scans of the same subject with different coordinate transformations to patient space and you want to resample one scan in the space of another scan. For example, if you have T1 and T2 images in different coordinate frames, and want to reslice the T2 image into the space of the T1
c3d t1.nii t2.nii -reslice-identity -o t2_in_t1_space.nii.
-reslice-identity: Resample image using identity transform
Syntax: -reslice-identity
Applies the -reslice-matrix command with the identity transform. This is useful when you have two scans of the same subject with different coordinate transformations to patient space and you want to resample one scan in the space of another scan. For example, if you have T1 and T2 images in different coordinate frames, and want to reslice the T2 image into the space of the T1
c3d t1.nii t2.nii -reslice-identity -o t2_in_t1_space.nii
6502 def run( 6503 self, 6504 execution: Execution, 6505 ) -> list[str]: 6506 """ 6507 Build command line arguments. This method is called by the main command. 6508 6509 Args: 6510 execution: The execution object. 6511 Returns: 6512 Command line arguments 6513 """ 6514 cargs = [] 6515 cargs.extend([ 6516 "-reslice-identity", 6517 self.reslice_identity 6518 ]) 6519 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6406@dataclasses.dataclass 6407class C3dResliceItk: 6408 """ 6409 -reslice-itk: Resample image using affine transform 6410 6411 Syntax: `-reslice-itk <transform_file> ` 6412 6413 Applies affine (or other) transform in ITK (ANTs) format to an image. See 6414 notes to **-reslice-matrix** for usage. 6415 """ 6416 reslice_itk: str 6417 """-reslice-itk: Resample image using affine transform 6418 6419 Syntax: `-reslice-itk <transform_file> ` 6420 6421 Applies affine (or other) transform in ITK (ANTs) format to an image. See 6422 notes to **-reslice-matrix** for usage.""" 6423 6424 def run( 6425 self, 6426 execution: Execution, 6427 ) -> list[str]: 6428 """ 6429 Build command line arguments. This method is called by the main command. 6430 6431 Args: 6432 execution: The execution object. 6433 Returns: 6434 Command line arguments 6435 """ 6436 cargs = [] 6437 cargs.extend([ 6438 "-reslice-itk", 6439 self.reslice_itk 6440 ]) 6441 return cargs
-reslice-itk: Resample image using affine transform
Syntax: -reslice-itk <transform_file>
Applies affine (or other) transform in ITK (ANTs) format to an image. See notes to -reslice-matrix for usage.
-reslice-itk: Resample image using affine transform
Syntax: -reslice-itk <transform_file>
Applies affine (or other) transform in ITK (ANTs) format to an image. See notes to -reslice-matrix for usage.
6424 def run( 6425 self, 6426 execution: Execution, 6427 ) -> list[str]: 6428 """ 6429 Build command line arguments. This method is called by the main command. 6430 6431 Args: 6432 execution: The execution object. 6433 Returns: 6434 Command line arguments 6435 """ 6436 cargs = [] 6437 cargs.extend([ 6438 "-reslice-itk", 6439 self.reslice_itk 6440 ]) 6441 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6444@dataclasses.dataclass 6445class C3dResliceMatrix: 6446 """ 6447 No description found. 6448 """ 6449 reslice_matrix: str 6450 """No description found.""" 6451 6452 def run( 6453 self, 6454 execution: Execution, 6455 ) -> list[str]: 6456 """ 6457 Build command line arguments. This method is called by the main command. 6458 6459 Args: 6460 execution: The execution object. 6461 Returns: 6462 Command line arguments 6463 """ 6464 cargs = [] 6465 cargs.extend([ 6466 "-reslice-matrix", 6467 self.reslice_matrix 6468 ]) 6469 return cargs
No description found.
6452 def run( 6453 self, 6454 execution: Execution, 6455 ) -> list[str]: 6456 """ 6457 Build command line arguments. This method is called by the main command. 6458 6459 Args: 6460 execution: The execution object. 6461 Returns: 6462 Command line arguments 6463 """ 6464 cargs = [] 6465 cargs.extend([ 6466 "-reslice-matrix", 6467 self.reslice_matrix 6468 ]) 6469 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5782@dataclasses.dataclass 5783class C3dRetainLabels: 5784 """ 5785 -retain-labels: Retain labels in a label image 5786 5787 Syntax: `-retain-labels I1 I2 ... IN` 5788 5789 Assuming that the input is a multi-label segmentation image, this command 5790 keeps all labels specifed in the list and replaces the remaining labels with 5791 the background value. 5792 5793 c3d seg.nii -retain-labels 2 3 4 8 -o subseg.nii. 5794 """ 5795 retain_labels: str 5796 """-retain-labels: Retain labels in a label image 5797 5798 Syntax: `-retain-labels I1 I2 ... IN` 5799 5800 Assuming that the input is a multi-label segmentation image, this command 5801 keeps all labels specifed in the list and replaces the remaining labels with 5802 the background value. 5803 5804 c3d seg.nii -retain-labels 2 3 4 8 -o subseg.nii""" 5805 5806 def run( 5807 self, 5808 execution: Execution, 5809 ) -> list[str]: 5810 """ 5811 Build command line arguments. This method is called by the main command. 5812 5813 Args: 5814 execution: The execution object. 5815 Returns: 5816 Command line arguments 5817 """ 5818 cargs = [] 5819 cargs.extend([ 5820 "-retain-labels", 5821 self.retain_labels 5822 ]) 5823 return cargs
-retain-labels: Retain labels in a label image
Syntax: -retain-labels I1 I2 ... IN
Assuming that the input is a multi-label segmentation image, this command keeps all labels specifed in the list and replaces the remaining labels with the background value.
c3d seg.nii -retain-labels 2 3 4 8 -o subseg.nii.
-retain-labels: Retain labels in a label image
Syntax: -retain-labels I1 I2 ... IN
Assuming that the input is a multi-label segmentation image, this command keeps all labels specifed in the list and replaces the remaining labels with the background value.
c3d seg.nii -retain-labels 2 3 4 8 -o subseg.nii
5806 def run( 5807 self, 5808 execution: Execution, 5809 ) -> list[str]: 5810 """ 5811 Build command line arguments. This method is called by the main command. 5812 5813 Args: 5814 execution: The execution object. 5815 Returns: 5816 Command line arguments 5817 """ 5818 cargs = [] 5819 cargs.extend([ 5820 "-retain-labels", 5821 self.retain_labels 5822 ]) 5823 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5826@dataclasses.dataclass 5827class C3dRfApply: 5828 """ 5829 -rf-apply: Apply Random Forest classifier 5830 5831 Syntax: `-rf-apply <classifier_file>` 5832 5833 This command applies a classifier trained previously by **-rf-train**. The 5834 stack must contain the same number of feature images as when training. The 5835 images will be removed from the stack and replaced with a set of K 5836 probability images, where K is the number of classes during training. See 5837 examples under **-rf-train** for usage. 5838 """ 5839 rf_apply: str 5840 """-rf-apply: Apply Random Forest classifier 5841 5842 Syntax: `-rf-apply <classifier_file>` 5843 5844 This command applies a classifier trained previously by **-rf-train**. The 5845 stack must contain the same number of feature images as when training. The 5846 images will be removed from the stack and replaced with a set of K 5847 probability images, where K is the number of classes during training. See 5848 examples under **-rf-train** for usage.""" 5849 5850 def run( 5851 self, 5852 execution: Execution, 5853 ) -> list[str]: 5854 """ 5855 Build command line arguments. This method is called by the main command. 5856 5857 Args: 5858 execution: The execution object. 5859 Returns: 5860 Command line arguments 5861 """ 5862 cargs = [] 5863 cargs.extend([ 5864 "-rf-apply", 5865 self.rf_apply 5866 ]) 5867 return cargs
-rf-apply: Apply Random Forest classifier
Syntax: -rf-apply <classifier_file>
This command applies a classifier trained previously by -rf-train. The stack must contain the same number of feature images as when training. The images will be removed from the stack and replaced with a set of K probability images, where K is the number of classes during training. See examples under -rf-train for usage.
-rf-apply: Apply Random Forest classifier
Syntax: -rf-apply <classifier_file>
This command applies a classifier trained previously by -rf-train. The stack must contain the same number of feature images as when training. The images will be removed from the stack and replaced with a set of K probability images, where K is the number of classes during training. See examples under -rf-train for usage.
5850 def run( 5851 self, 5852 execution: Execution, 5853 ) -> list[str]: 5854 """ 5855 Build command line arguments. This method is called by the main command. 5856 5857 Args: 5858 execution: The execution object. 5859 Returns: 5860 Command line arguments 5861 """ 5862 cargs = [] 5863 cargs.extend([ 5864 "-rf-apply", 5865 self.rf_apply 5866 ]) 5867 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6074@dataclasses.dataclass 6075class C3dRfParamNousexyz: 6076 """ 6077 No description found. 6078 """ 6079 rf_param_nousexyz: str 6080 """No description found.""" 6081 6082 def run( 6083 self, 6084 execution: Execution, 6085 ) -> list[str]: 6086 """ 6087 Build command line arguments. This method is called by the main command. 6088 6089 Args: 6090 execution: The execution object. 6091 Returns: 6092 Command line arguments 6093 """ 6094 cargs = [] 6095 cargs.extend([ 6096 "-rf-param-nousexyz", 6097 self.rf_param_nousexyz 6098 ]) 6099 return cargs
No description found.
6082 def run( 6083 self, 6084 execution: Execution, 6085 ) -> list[str]: 6086 """ 6087 Build command line arguments. This method is called by the main command. 6088 6089 Args: 6090 execution: The execution object. 6091 Returns: 6092 Command line arguments 6093 """ 6094 cargs = [] 6095 cargs.extend([ 6096 "-rf-param-nousexyz", 6097 self.rf_param_nousexyz 6098 ]) 6099 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6102@dataclasses.dataclass 6103class C3dRfParamNtrees: 6104 """ 6105 -rf-param-ntrees: Random Forest forest size 6106 6107 Syntax: `-rf-param-ntrees <integer>` 6108 6109 Sets the number of trees in the forest. Default value is 50. Larger forests 6110 are more robust but more time to train and apply. 6111 """ 6112 rf_param_ntrees: str 6113 """-rf-param-ntrees: Random Forest forest size 6114 6115 Syntax: `-rf-param-ntrees <integer>` 6116 6117 Sets the number of trees in the forest. Default value is 50. Larger forests 6118 are more robust but more time to train and apply.""" 6119 6120 def run( 6121 self, 6122 execution: Execution, 6123 ) -> list[str]: 6124 """ 6125 Build command line arguments. This method is called by the main command. 6126 6127 Args: 6128 execution: The execution object. 6129 Returns: 6130 Command line arguments 6131 """ 6132 cargs = [] 6133 cargs.extend([ 6134 "-rf-param-ntrees", 6135 self.rf_param_ntrees 6136 ]) 6137 return cargs
-rf-param-ntrees: Random Forest forest size
Syntax: -rf-param-ntrees <integer>
Sets the number of trees in the forest. Default value is 50. Larger forests are more robust but more time to train and apply.
-rf-param-ntrees: Random Forest forest size
Syntax: -rf-param-ntrees <integer>
Sets the number of trees in the forest. Default value is 50. Larger forests are more robust but more time to train and apply.
6120 def run( 6121 self, 6122 execution: Execution, 6123 ) -> list[str]: 6124 """ 6125 Build command line arguments. This method is called by the main command. 6126 6127 Args: 6128 execution: The execution object. 6129 Returns: 6130 Command line arguments 6131 """ 6132 cargs = [] 6133 cargs.extend([ 6134 "-rf-param-ntrees", 6135 self.rf_param_ntrees 6136 ]) 6137 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5982@dataclasses.dataclass 5983class C3dRfParamPatch: 5984 """ 5985 -rf-param-patch: Random Forest training patch size 5986 5987 Syntax: `-rf-param-patch <size_spec>` 5988 5989 Set the radius of the patch used to generate features for the RF classifier. 5990 By default this is zero, which means that just the intensity of each voxel 5991 is used as a feature. Setting this to non-zero values will result in 5992 neighboring intensities also being used as features, and can improve 5993 classification in presence of complex image texture. The patch size in each 5994 dimension is (2 * radius + 1). See **-rf-train** command for details. 5995 5996 # Set patch size to 5x5x5 5997 c3d ... -rf-param-patch 2x2x2 ... -rf-train myforest.rf. 5998 """ 5999 rf_param_patch: str 6000 """-rf-param-patch: Random Forest training patch size 6001 6002 Syntax: `-rf-param-patch <size_spec>` 6003 6004 Set the radius of the patch used to generate features for the RF classifier. 6005 By default this is zero, which means that just the intensity of each voxel 6006 is used as a feature. Setting this to non-zero values will result in 6007 neighboring intensities also being used as features, and can improve 6008 classification in presence of complex image texture. The patch size in each 6009 dimension is (2 * radius + 1). See **-rf-train** command for details. 6010 6011 # Set patch size to 5x5x5 6012 c3d ... -rf-param-patch 2x2x2 ... -rf-train myforest.rf""" 6013 6014 def run( 6015 self, 6016 execution: Execution, 6017 ) -> list[str]: 6018 """ 6019 Build command line arguments. This method is called by the main command. 6020 6021 Args: 6022 execution: The execution object. 6023 Returns: 6024 Command line arguments 6025 """ 6026 cargs = [] 6027 cargs.extend([ 6028 "-rf-param-patch", 6029 self.rf_param_patch 6030 ]) 6031 return cargs
-rf-param-patch: Random Forest training patch size
Syntax: -rf-param-patch <size_spec>
Set the radius of the patch used to generate features for the RF classifier. By default this is zero, which means that just the intensity of each voxel is used as a feature. Setting this to non-zero values will result in neighboring intensities also being used as features, and can improve classification in presence of complex image texture. The patch size in each dimension is (2 * radius + 1). See -rf-train command for details.
Set patch size to 5x5x5
c3d ... -rf-param-patch 2x2x2 ... -rf-train myforest.rf.
-rf-param-patch: Random Forest training patch size
Syntax: -rf-param-patch <size_spec>
Set the radius of the patch used to generate features for the RF classifier. By default this is zero, which means that just the intensity of each voxel is used as a feature. Setting this to non-zero values will result in neighboring intensities also being used as features, and can improve classification in presence of complex image texture. The patch size in each dimension is (2 * radius + 1). See -rf-train command for details.
Set patch size to 5x5x5
c3d ... -rf-param-patch 2x2x2 ... -rf-train myforest.rf
6014 def run( 6015 self, 6016 execution: Execution, 6017 ) -> list[str]: 6018 """ 6019 Build command line arguments. This method is called by the main command. 6020 6021 Args: 6022 execution: The execution object. 6023 Returns: 6024 Command line arguments 6025 """ 6026 cargs = [] 6027 cargs.extend([ 6028 "-rf-param-patch", 6029 self.rf_param_patch 6030 ]) 6031 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6140@dataclasses.dataclass 6141class C3dRfParamTreedepth: 6142 """ 6143 -rf-param-treedepth: Random Forest tree depth 6144 6145 Syntax: `-rf-param-treedepth <integer>` 6146 6147 Sets the depth of the trees in the classifier. Default value is 30. Deeper 6148 trees can learn on more complex data but require more time. 6149 """ 6150 rf_param_treedepth: str 6151 """-rf-param-treedepth: Random Forest tree depth 6152 6153 Syntax: `-rf-param-treedepth <integer>` 6154 6155 Sets the depth of the trees in the classifier. Default value is 30. Deeper 6156 trees can learn on more complex data but require more time.""" 6157 6158 def run( 6159 self, 6160 execution: Execution, 6161 ) -> list[str]: 6162 """ 6163 Build command line arguments. This method is called by the main command. 6164 6165 Args: 6166 execution: The execution object. 6167 Returns: 6168 Command line arguments 6169 """ 6170 cargs = [] 6171 cargs.extend([ 6172 "-rf-param-treedepth", 6173 self.rf_param_treedepth 6174 ]) 6175 return cargs
-rf-param-treedepth: Random Forest tree depth
Syntax: -rf-param-treedepth <integer>
Sets the depth of the trees in the classifier. Default value is 30. Deeper trees can learn on more complex data but require more time.
-rf-param-treedepth: Random Forest tree depth
Syntax: -rf-param-treedepth <integer>
Sets the depth of the trees in the classifier. Default value is 30. Deeper trees can learn on more complex data but require more time.
6158 def run( 6159 self, 6160 execution: Execution, 6161 ) -> list[str]: 6162 """ 6163 Build command line arguments. This method is called by the main command. 6164 6165 Args: 6166 execution: The execution object. 6167 Returns: 6168 Command line arguments 6169 """ 6170 cargs = [] 6171 cargs.extend([ 6172 "-rf-param-treedepth", 6173 self.rf_param_treedepth 6174 ]) 6175 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6034@dataclasses.dataclass 6035class C3dRfParamUsexyz: 6036 """ 6037 -rf-param-usexyz: Random Forest coordinate features 6038 6039 Syntax: `-rf-param-usexyz` 6040 6041 Use the coordinates of voxels as additional features. This allows some 6042 geometric relations between different labels to be learned. Equivalent to 6043 the corresponding ITK-SNAP option. 6044 """ 6045 rf_param_usexyz: str 6046 """-rf-param-usexyz: Random Forest coordinate features 6047 6048 Syntax: `-rf-param-usexyz` 6049 6050 Use the coordinates of voxels as additional features. This allows some 6051 geometric relations between different labels to be learned. Equivalent to 6052 the corresponding ITK-SNAP option.""" 6053 6054 def run( 6055 self, 6056 execution: Execution, 6057 ) -> list[str]: 6058 """ 6059 Build command line arguments. This method is called by the main command. 6060 6061 Args: 6062 execution: The execution object. 6063 Returns: 6064 Command line arguments 6065 """ 6066 cargs = [] 6067 cargs.extend([ 6068 "-rf-param-usexyz", 6069 self.rf_param_usexyz 6070 ]) 6071 return cargs
-rf-param-usexyz: Random Forest coordinate features
Syntax: -rf-param-usexyz
Use the coordinates of voxels as additional features. This allows some geometric relations between different labels to be learned. Equivalent to the corresponding ITK-SNAP option.
-rf-param-usexyz: Random Forest coordinate features
Syntax: -rf-param-usexyz
Use the coordinates of voxels as additional features. This allows some geometric relations between different labels to be learned. Equivalent to the corresponding ITK-SNAP option.
6054 def run( 6055 self, 6056 execution: Execution, 6057 ) -> list[str]: 6058 """ 6059 Build command line arguments. This method is called by the main command. 6060 6061 Args: 6062 execution: The execution object. 6063 Returns: 6064 Command line arguments 6065 """ 6066 cargs = [] 6067 cargs.extend([ 6068 "-rf-param-usexyz", 6069 self.rf_param_usexyz 6070 ]) 6071 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
5870@dataclasses.dataclass 5871class C3dRfTrain: 5872 """ 5873 -rf-train: Train Random Forest classifier 5874 5875 Syntax: `-rf-train <classifier_file>` 5876 5877 This command trains a classifier using an implementation of the [Breyman et 5878 al. Random Forest Algorithm][Br2001], with modifications proposed by 5879 [Criminisi and Shotton][Cr2004]. The stack must contain one or more images 5880 of features (e.g., grayscale images), followed by a multi-label image. The 5881 latter must have at least two non-zero labels corresponding to different 5882 classes. The classifier is trained on a voxel by voxel basis. All voxels 5883 with label *L* are treated as the examples of class *L*. The classifier is 5884 output to a binary file that can later be used by the **-rf-apply** command. 5885 Multiple parameters can be specified with the **-rf-param-xxx** options 5886 before calling **-rf-train**. The stack is not modified by this command. 5887 5888 # Training with two MRI modalities as features and default parameters 5889 c3d t1_mri.nii t2_mri.nii segmentation.nii -rf-train myforest1.rf 5890 5891 # Training with patches as features (see docs for -rf-param-patch) 5892 c3d ultrasound.nii seg.nii -rf-param-patch 2x2x2 -rf-train myforest2.rf 5893 5894 # Applying the classifier 5895 c3d ultrasound.nii -rf-apply myforest2.rf -omc class_prob.nii.gz 5896 5897 The commands are meant to replicate the "classification" pre-segmentation 5898 mode in ITK-SNAP, i.e., extending a rough example segmentation to the entire 5899 image domain. It is possible to also use the commands to train classifiers 5900 jointly on data from multiple subjects, each with its own segmentation, as 5901 long as the images from the different subjects occupy the same image space 5902 and can be stacked into a 4-dimensional image. For example: 5903 5904 # Train using MRI and segmentations from N subjects 5905 c4d mri_subj*.nii -tile w -popas ALLMRI \ 5906 seg_subj*.nii -tile w -popas ALLSEG \ 5907 -rf-param-patch 2x2x2x0 \ 5908 -push ALLMRI -push ALLSEG -rf-train myforest.rf 5909 5910 # Apply using single MRI 5911 c4d mri_new.nii -rf-apply myforest.rf -omc classprob.nii 5912 5913 [Br2001] Breiman, L. (2001). Random forests. Machine learning, 45(1), 5-32. 5914 [Cr2004] Criminisi, A., & Shotton, J. (2013). Decision forests for computer 5915 vision and medical image analysis. Springer Science & Business Media. 5916 """ 5917 rf_train: str 5918 """-rf-train: Train Random Forest classifier 5919 5920 Syntax: `-rf-train <classifier_file>` 5921 5922 This command trains a classifier using an implementation of the [Breyman et 5923 al. Random Forest Algorithm][Br2001], with modifications proposed by 5924 [Criminisi and Shotton][Cr2004]. The stack must contain one or more images 5925 of features (e.g., grayscale images), followed by a multi-label image. The 5926 latter must have at least two non-zero labels corresponding to different 5927 classes. The classifier is trained on a voxel by voxel basis. All voxels 5928 with label *L* are treated as the examples of class *L*. The classifier is 5929 output to a binary file that can later be used by the **-rf-apply** command. 5930 Multiple parameters can be specified with the **-rf-param-xxx** options 5931 before calling **-rf-train**. The stack is not modified by this command. 5932 5933 # Training with two MRI modalities as features and default parameters 5934 c3d t1_mri.nii t2_mri.nii segmentation.nii -rf-train myforest1.rf 5935 5936 # Training with patches as features (see docs for -rf-param-patch) 5937 c3d ultrasound.nii seg.nii -rf-param-patch 2x2x2 -rf-train myforest2.rf 5938 5939 # Applying the classifier 5940 c3d ultrasound.nii -rf-apply myforest2.rf -omc class_prob.nii.gz 5941 5942 The commands are meant to replicate the "classification" pre-segmentation 5943 mode in ITK-SNAP, i.e., extending a rough example segmentation to the entire 5944 image domain. It is possible to also use the commands to train classifiers 5945 jointly on data from multiple subjects, each with its own segmentation, as 5946 long as the images from the different subjects occupy the same image space 5947 and can be stacked into a 4-dimensional image. For example: 5948 5949 # Train using MRI and segmentations from N subjects 5950 c4d mri_subj*.nii -tile w -popas ALLMRI \ 5951 seg_subj*.nii -tile w -popas ALLSEG \ 5952 -rf-param-patch 2x2x2x0 \ 5953 -push ALLMRI -push ALLSEG -rf-train myforest.rf 5954 5955 # Apply using single MRI 5956 c4d mri_new.nii -rf-apply myforest.rf -omc classprob.nii 5957 5958 [Br2001] Breiman, L. (2001). Random forests. Machine learning, 45(1), 5-32. 5959 [Cr2004] Criminisi, A., & Shotton, J. (2013). Decision forests for computer 5960 vision and medical image analysis. Springer Science & Business Media""" 5961 5962 def run( 5963 self, 5964 execution: Execution, 5965 ) -> list[str]: 5966 """ 5967 Build command line arguments. This method is called by the main command. 5968 5969 Args: 5970 execution: The execution object. 5971 Returns: 5972 Command line arguments 5973 """ 5974 cargs = [] 5975 cargs.extend([ 5976 "-rf-train", 5977 self.rf_train 5978 ]) 5979 return cargs
-rf-train: Train Random Forest classifier
Syntax: -rf-train <classifier_file>
This command trains a classifier using an implementation of the [Breyman et al. Random Forest Algorithm][Br2001], with modifications proposed by [Criminisi and Shotton][Cr2004]. The stack must contain one or more images of features (e.g., grayscale images), followed by a multi-label image. The latter must have at least two non-zero labels corresponding to different classes. The classifier is trained on a voxel by voxel basis. All voxels with label L are treated as the examples of class L. The classifier is output to a binary file that can later be used by the -rf-apply command. Multiple parameters can be specified with the -rf-param-xxx options before calling -rf-train. The stack is not modified by this command.
Training with two MRI modalities as features and default parameters
c3d t1_mri.nii t2_mri.nii segmentation.nii -rf-train myforest1.rf
Training with patches as features (see docs for -rf-param-patch)
c3d ultrasound.nii seg.nii -rf-param-patch 2x2x2 -rf-train myforest2.rf
Applying the classifier
c3d ultrasound.nii -rf-apply myforest2.rf -omc class_prob.nii.gz
The commands are meant to replicate the "classification" pre-segmentation mode in ITK-SNAP, i.e., extending a rough example segmentation to the entire image domain. It is possible to also use the commands to train classifiers jointly on data from multiple subjects, each with its own segmentation, as long as the images from the different subjects occupy the same image space and can be stacked into a 4-dimensional image. For example:
Train using MRI and segmentations from N subjects
c4d mri_subj*.nii -tile w -popas ALLMRI seg_subj*.nii -tile w -popas ALLSEG -rf-param-patch 2x2x2x0 -push ALLMRI -push ALLSEG -rf-train myforest.rf
Apply using single MRI
c4d mri_new.nii -rf-apply myforest.rf -omc classprob.nii
[Br2001] Breiman, L. (2001). Random forests. Machine learning, 45(1), 5-32. [Cr2004] Criminisi, A., & Shotton, J. (2013). Decision forests for computer vision and medical image analysis. Springer Science & Business Media.
-rf-train: Train Random Forest classifier
Syntax: -rf-train <classifier_file>
This command trains a classifier using an implementation of the [Breyman et al. Random Forest Algorithm][Br2001], with modifications proposed by [Criminisi and Shotton][Cr2004]. The stack must contain one or more images of features (e.g., grayscale images), followed by a multi-label image. The latter must have at least two non-zero labels corresponding to different classes. The classifier is trained on a voxel by voxel basis. All voxels with label L are treated as the examples of class L. The classifier is output to a binary file that can later be used by the -rf-apply command. Multiple parameters can be specified with the -rf-param-xxx options before calling -rf-train. The stack is not modified by this command.
Training with two MRI modalities as features and default parameters
c3d t1_mri.nii t2_mri.nii segmentation.nii -rf-train myforest1.rf
Training with patches as features (see docs for -rf-param-patch)
c3d ultrasound.nii seg.nii -rf-param-patch 2x2x2 -rf-train myforest2.rf
Applying the classifier
c3d ultrasound.nii -rf-apply myforest2.rf -omc class_prob.nii.gz
The commands are meant to replicate the "classification" pre-segmentation mode in ITK-SNAP, i.e., extending a rough example segmentation to the entire image domain. It is possible to also use the commands to train classifiers jointly on data from multiple subjects, each with its own segmentation, as long as the images from the different subjects occupy the same image space and can be stacked into a 4-dimensional image. For example:
Train using MRI and segmentations from N subjects
c4d mri_subj*.nii -tile w -popas ALLMRI seg_subj*.nii -tile w -popas ALLSEG -rf-param-patch 2x2x2x0 -push ALLMRI -push ALLSEG -rf-train myforest.rf
Apply using single MRI
c4d mri_new.nii -rf-apply myforest.rf -omc classprob.nii
[Br2001] Breiman, L. (2001). Random forests. Machine learning, 45(1), 5-32. [Cr2004] Criminisi, A., & Shotton, J. (2013). Decision forests for computer vision and medical image analysis. Springer Science & Business Media
5962 def run( 5963 self, 5964 execution: Execution, 5965 ) -> list[str]: 5966 """ 5967 Build command line arguments. This method is called by the main command. 5968 5969 Args: 5970 execution: The execution object. 5971 Returns: 5972 Command line arguments 5973 """ 5974 cargs = [] 5975 cargs.extend([ 5976 "-rf-train", 5977 self.rf_train 5978 ]) 5979 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6522@dataclasses.dataclass 6523class C3dRgb2hsv: 6524 """ 6525 -rgb2hsv: Convert RGB image to HSV image 6526 6527 Syntax `-rgb2hsv` 6528 6529 Takes the last three images on the stack and treats them as red, green, and 6530 blue channels. Outputs three images corresponding to hue, saturation, value. 6531 To read color images you need the ***-msc*** command. 6532 6533 c3d -mcs color.png -rgb2hsv -omc hsv.png. 6534 """ 6535 rgb2hsv: str 6536 """-rgb2hsv: Convert RGB image to HSV image 6537 6538 Syntax `-rgb2hsv` 6539 6540 Takes the last three images on the stack and treats them as red, green, and 6541 blue channels. Outputs three images corresponding to hue, saturation, value. 6542 To read color images you need the ***-msc*** command. 6543 6544 c3d -mcs color.png -rgb2hsv -omc hsv.png""" 6545 6546 def run( 6547 self, 6548 execution: Execution, 6549 ) -> list[str]: 6550 """ 6551 Build command line arguments. This method is called by the main command. 6552 6553 Args: 6554 execution: The execution object. 6555 Returns: 6556 Command line arguments 6557 """ 6558 cargs = [] 6559 cargs.extend([ 6560 "-rgb2hsv", 6561 self.rgb2hsv 6562 ]) 6563 return cargs
-rgb2hsv: Convert RGB image to HSV image
Syntax -rgb2hsv
Takes the last three images on the stack and treats them as red, green, and blue channels. Outputs three images corresponding to hue, saturation, value. To read color images you need the -msc command.
c3d -mcs color.png -rgb2hsv -omc hsv.png.
-rgb2hsv: Convert RGB image to HSV image
Syntax -rgb2hsv
Takes the last three images on the stack and treats them as red, green, and blue channels. Outputs three images corresponding to hue, saturation, value. To read color images you need the -msc command.
c3d -mcs color.png -rgb2hsv -omc hsv.png
6546 def run( 6547 self, 6548 execution: Execution, 6549 ) -> list[str]: 6550 """ 6551 Build command line arguments. This method is called by the main command. 6552 6553 Args: 6554 execution: The execution object. 6555 Returns: 6556 Command line arguments 6557 """ 6558 cargs = [] 6559 cargs.extend([ 6560 "-rgb2hsv", 6561 self.rgb2hsv 6562 ]) 6563 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6566@dataclasses.dataclass 6567class C3dRms: 6568 """ 6569 -rms: Voxelwise vector norm 6570 6571 Syntax: `-rms` 6572 6573 Computes RMS (root mean square) of all images on the stack. The command 6574 takes the square of each image on the stack, adds all the squared images and 6575 takes the square root of the result. This is very useful for statistical 6576 operations. Images must have the same size. 6577 6578 c3d img1.img img2.img img3.img img4.img -rms -o rms.img 6579 6580 The equivalent of this command is 6581 6582 c3d img1.img img2.img img3.img img4.img -foreach -dup -times -endfor \ 6583 -accum -add -endaccum -sqrt -o rms.img. 6584 """ 6585 rms: str 6586 """-rms: Voxelwise vector norm 6587 6588 Syntax: `-rms` 6589 6590 Computes RMS (root mean square) of all images on the stack. The command 6591 takes the square of each image on the stack, adds all the squared images and 6592 takes the square root of the result. This is very useful for statistical 6593 operations. Images must have the same size. 6594 6595 c3d img1.img img2.img img3.img img4.img -rms -o rms.img 6596 6597 The equivalent of this command is 6598 6599 c3d img1.img img2.img img3.img img4.img -foreach -dup -times -endfor \ 6600 -accum -add -endaccum -sqrt -o rms.img""" 6601 6602 def run( 6603 self, 6604 execution: Execution, 6605 ) -> list[str]: 6606 """ 6607 Build command line arguments. This method is called by the main command. 6608 6609 Args: 6610 execution: The execution object. 6611 Returns: 6612 Command line arguments 6613 """ 6614 cargs = [] 6615 cargs.extend([ 6616 "-rms", 6617 self.rms 6618 ]) 6619 return cargs
-rms: Voxelwise vector norm
Syntax: -rms
Computes RMS (root mean square) of all images on the stack. The command takes the square of each image on the stack, adds all the squared images and takes the square root of the result. This is very useful for statistical operations. Images must have the same size.
c3d img1.img img2.img img3.img img4.img -rms -o rms.img
The equivalent of this command is
c3d img1.img img2.img img3.img img4.img -foreach -dup -times -endfor -accum -add -endaccum -sqrt -o rms.img.
-rms: Voxelwise vector norm
Syntax: -rms
Computes RMS (root mean square) of all images on the stack. The command takes the square of each image on the stack, adds all the squared images and takes the square root of the result. This is very useful for statistical operations. Images must have the same size.
c3d img1.img img2.img img3.img img4.img -rms -o rms.img
The equivalent of this command is
c3d img1.img img2.img img3.img img4.img -foreach -dup -times -endfor -accum -add -endaccum -sqrt -o rms.img
6602 def run( 6603 self, 6604 execution: Execution, 6605 ) -> list[str]: 6606 """ 6607 Build command line arguments. This method is called by the main command. 6608 6609 Args: 6610 execution: The execution object. 6611 Returns: 6612 Command line arguments 6613 """ 6614 cargs = [] 6615 cargs.extend([ 6616 "-rms", 6617 self.rms 6618 ]) 6619 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6622@dataclasses.dataclass 6623class C3dRound: 6624 """ 6625 -noround, -round: Floating point rounding behavior 6626 6627 Syntax: `-noround` or `-round ` 6628 6629 By default, **convert3d** will round floating point values when converting 6630 to an integer, short or byte image. This command specifies that rounding 6631 should not be used. Rounding is used to avoid numerical errors stemming from 6632 the internal floating point representation. 6633 6634 c3d image1.img -type short -noround image2.img. 6635 """ 6636 round_: str 6637 """-noround, -round: Floating point rounding behavior 6638 6639 Syntax: `-noround` or `-round ` 6640 6641 By default, **convert3d** will round floating point values when converting 6642 to an integer, short or byte image. This command specifies that rounding 6643 should not be used. Rounding is used to avoid numerical errors stemming from 6644 the internal floating point representation. 6645 6646 c3d image1.img -type short -noround image2.img""" 6647 6648 def run( 6649 self, 6650 execution: Execution, 6651 ) -> list[str]: 6652 """ 6653 Build command line arguments. This method is called by the main command. 6654 6655 Args: 6656 execution: The execution object. 6657 Returns: 6658 Command line arguments 6659 """ 6660 cargs = [] 6661 cargs.extend([ 6662 "-round", 6663 self.round_ 6664 ]) 6665 return cargs
-noround, -round: Floating point rounding behavior
Syntax: -noround or -round
By default, convert3d will round floating point values when converting to an integer, short or byte image. This command specifies that rounding should not be used. Rounding is used to avoid numerical errors stemming from the internal floating point representation.
c3d image1.img -type short -noround image2.img.
-noround, -round: Floating point rounding behavior
Syntax: -noround or -round
By default, convert3d will round floating point values when converting to an integer, short or byte image. This command specifies that rounding should not be used. Rounding is used to avoid numerical errors stemming from the internal floating point representation.
c3d image1.img -type short -noround image2.img
6648 def run( 6649 self, 6650 execution: Execution, 6651 ) -> list[str]: 6652 """ 6653 Build command line arguments. This method is called by the main command. 6654 6655 Args: 6656 execution: The execution object. 6657 Returns: 6658 Command line arguments 6659 """ 6660 cargs = [] 6661 cargs.extend([ 6662 "-round", 6663 self.round_ 6664 ]) 6665 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6668@dataclasses.dataclass 6669class C3dScale: 6670 """ 6671 -scale: Scale intensity by constant factor 6672 6673 Syntax: `-scale <factor>` 6674 6675 Multiplies the intensity of each voxel in the last image on the stack by the 6676 given factor. 6677 6678 c3d img1.img -scale 0.5 -o img2.img. 6679 """ 6680 scale: str 6681 """-scale: Scale intensity by constant factor 6682 6683 Syntax: `-scale <factor>` 6684 6685 Multiplies the intensity of each voxel in the last image on the stack by the 6686 given factor. 6687 6688 c3d img1.img -scale 0.5 -o img2.img""" 6689 6690 def run( 6691 self, 6692 execution: Execution, 6693 ) -> list[str]: 6694 """ 6695 Build command line arguments. This method is called by the main command. 6696 6697 Args: 6698 execution: The execution object. 6699 Returns: 6700 Command line arguments 6701 """ 6702 cargs = [] 6703 cargs.extend([ 6704 "-scale", 6705 self.scale 6706 ]) 6707 return cargs
-scale: Scale intensity by constant factor
Syntax: -scale <factor>
Multiplies the intensity of each voxel in the last image on the stack by the given factor.
c3d img1.img -scale 0.5 -o img2.img.
-scale: Scale intensity by constant factor
Syntax: -scale <factor>
Multiplies the intensity of each voxel in the last image on the stack by the given factor.
c3d img1.img -scale 0.5 -o img2.img
6690 def run( 6691 self, 6692 execution: Execution, 6693 ) -> list[str]: 6694 """ 6695 Build command line arguments. This method is called by the main command. 6696 6697 Args: 6698 execution: The execution object. 6699 Returns: 6700 Command line arguments 6701 """ 6702 cargs = [] 6703 cargs.extend([ 6704 "-scale", 6705 self.scale 6706 ]) 6707 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
304@dataclasses.dataclass 305class C3dSet: 306 """ 307 -as: Assign image at the end of the stack to a variable 308 309 Syntax: `-as var` 310 311 Associates the image currently at the end of the stack with variable name 312 'var'. This allows you to retrieve the image later on the command line using 313 the **-push** command. The **-as** and **-push** commands are useful when 314 you need to use a certain image more than once during a convert3d operation. 315 For example, if you want to compute the distance transform of a binary image 316 and mask it so that the values outside of the binary image region have value 317 0, you would use the following command: 318 319 c3d binary.img -as A -sdt -push A -times -o masked_distance.img. 320 """ 321 set_: str 322 """-as: Assign image at the end of the stack to a variable 323 324 Syntax: `-as var` 325 326 Associates the image currently at the end of the stack with variable name 327 'var'. This allows you to retrieve the image later on the command line using 328 the **-push** command. The **-as** and **-push** commands are useful when 329 you need to use a certain image more than once during a convert3d operation. 330 For example, if you want to compute the distance transform of a binary image 331 and mask it so that the values outside of the binary image region have value 332 0, you would use the following command: 333 334 c3d binary.img -as A -sdt -push A -times -o masked_distance.img""" 335 336 def run( 337 self, 338 execution: Execution, 339 ) -> list[str]: 340 """ 341 Build command line arguments. This method is called by the main command. 342 343 Args: 344 execution: The execution object. 345 Returns: 346 Command line arguments 347 """ 348 cargs = [] 349 cargs.extend([ 350 "-as", 351 self.set_ 352 ]) 353 return cargs
-as: Assign image at the end of the stack to a variable
Syntax: -as var
Associates the image currently at the end of the stack with variable name 'var'. This allows you to retrieve the image later on the command line using the -push command. The -as and -push commands are useful when you need to use a certain image more than once during a convert3d operation. For example, if you want to compute the distance transform of a binary image and mask it so that the values outside of the binary image region have value 0, you would use the following command:
c3d binary.img -as A -sdt -push A -times -o masked_distance.img.
-as: Assign image at the end of the stack to a variable
Syntax: -as var
Associates the image currently at the end of the stack with variable name 'var'. This allows you to retrieve the image later on the command line using the -push command. The -as and -push commands are useful when you need to use a certain image more than once during a convert3d operation. For example, if you want to compute the distance transform of a binary image and mask it so that the values outside of the binary image region have value 0, you would use the following command:
c3d binary.img -as A -sdt -push A -times -o masked_distance.img
336 def run( 337 self, 338 execution: Execution, 339 ) -> list[str]: 340 """ 341 Build command line arguments. This method is called by the main command. 342 343 Args: 344 execution: The execution object. 345 Returns: 346 Command line arguments 347 """ 348 cargs = [] 349 cargs.extend([ 350 "-as", 351 self.set_ 352 ]) 353 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6178@dataclasses.dataclass 6179class C3dSetSform: 6180 """ 6181 -set-sform: Set the transform to physical space 6182 6183 Syntax: `-set-sform <sform.mat> ` 6184 6185 Sets the Nifti sform of the last image on the stack to the 4x4 matrix 6186 provided. 6187 """ 6188 set_sform: str 6189 """-set-sform: Set the transform to physical space 6190 6191 Syntax: `-set-sform <sform.mat> ` 6192 6193 Sets the Nifti sform of the last image on the stack to the 4x4 matrix 6194 provided.""" 6195 6196 def run( 6197 self, 6198 execution: Execution, 6199 ) -> list[str]: 6200 """ 6201 Build command line arguments. This method is called by the main command. 6202 6203 Args: 6204 execution: The execution object. 6205 Returns: 6206 Command line arguments 6207 """ 6208 cargs = [] 6209 cargs.extend([ 6210 "-set-sform", 6211 self.set_sform 6212 ]) 6213 return cargs
-set-sform: Set the transform to physical space
Syntax: -set-sform <sform.mat>
Sets the Nifti sform of the last image on the stack to the 4x4 matrix provided.
-set-sform: Set the transform to physical space
Syntax: -set-sform <sform.mat>
Sets the Nifti sform of the last image on the stack to the 4x4 matrix provided.
6196 def run( 6197 self, 6198 execution: Execution, 6199 ) -> list[str]: 6200 """ 6201 Build command line arguments. This method is called by the main command. 6202 6203 Args: 6204 execution: The execution object. 6205 Returns: 6206 Command line arguments 6207 """ 6208 cargs = [] 6209 cargs.extend([ 6210 "-set-sform", 6211 self.set_sform 6212 ]) 6213 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6710@dataclasses.dataclass 6711class C3dSetSform_: 6712 """ 6713 -set-sform: Set the transform to physical space 6714 6715 Syntax: `-set-sform <sform.mat> ` 6716 6717 Sets the Nifti sform of the last image on the stack to the 4x4 matrix 6718 provided. 6719 """ 6720 set_sform: str 6721 """-set-sform: Set the transform to physical space 6722 6723 Syntax: `-set-sform <sform.mat> ` 6724 6725 Sets the Nifti sform of the last image on the stack to the 4x4 matrix 6726 provided.""" 6727 6728 def run( 6729 self, 6730 execution: Execution, 6731 ) -> list[str]: 6732 """ 6733 Build command line arguments. This method is called by the main command. 6734 6735 Args: 6736 execution: The execution object. 6737 Returns: 6738 Command line arguments 6739 """ 6740 cargs = [] 6741 cargs.extend([ 6742 "-set-sform", 6743 self.set_sform 6744 ]) 6745 return cargs
-set-sform: Set the transform to physical space
Syntax: -set-sform <sform.mat>
Sets the Nifti sform of the last image on the stack to the 4x4 matrix provided.
-set-sform: Set the transform to physical space
Syntax: -set-sform <sform.mat>
Sets the Nifti sform of the last image on the stack to the 4x4 matrix provided.
6728 def run( 6729 self, 6730 execution: Execution, 6731 ) -> list[str]: 6732 """ 6733 Build command line arguments. This method is called by the main command. 6734 6735 Args: 6736 execution: The execution object. 6737 Returns: 6738 Command line arguments 6739 """ 6740 cargs = [] 6741 cargs.extend([ 6742 "-set-sform", 6743 self.set_sform 6744 ]) 6745 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6904@dataclasses.dataclass 6905class C3dSharpen: 6906 """ 6907 -sharpen: Sharpen edges in the image 6908 6909 Syntax: `-sharpen` 6910 6911 Applies the Laplacian sharpening filter from ITK, which accentuates the 6912 edges in the image. 6913 6914 c3d input.nii.gz -sharpen -o output.nii.gz. 6915 """ 6916 sharpen: str 6917 """-sharpen: Sharpen edges in the image 6918 6919 Syntax: `-sharpen` 6920 6921 Applies the Laplacian sharpening filter from ITK, which accentuates the 6922 edges in the image. 6923 6924 c3d input.nii.gz -sharpen -o output.nii.gz""" 6925 6926 def run( 6927 self, 6928 execution: Execution, 6929 ) -> list[str]: 6930 """ 6931 Build command line arguments. This method is called by the main command. 6932 6933 Args: 6934 execution: The execution object. 6935 Returns: 6936 Command line arguments 6937 """ 6938 cargs = [] 6939 cargs.extend([ 6940 "-sharpen", 6941 self.sharpen 6942 ]) 6943 return cargs
-sharpen: Sharpen edges in the image
Syntax: -sharpen
Applies the Laplacian sharpening filter from ITK, which accentuates the edges in the image.
c3d input.nii.gz -sharpen -o output.nii.gz.
-sharpen: Sharpen edges in the image
Syntax: -sharpen
Applies the Laplacian sharpening filter from ITK, which accentuates the edges in the image.
c3d input.nii.gz -sharpen -o output.nii.gz
6926 def run( 6927 self, 6928 execution: Execution, 6929 ) -> list[str]: 6930 """ 6931 Build command line arguments. This method is called by the main command. 6932 6933 Args: 6934 execution: The execution object. 6935 Returns: 6936 Command line arguments 6937 """ 6938 cargs = [] 6939 cargs.extend([ 6940 "-sharpen", 6941 self.sharpen 6942 ]) 6943 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6946@dataclasses.dataclass 6947class C3dShift: 6948 """ 6949 -shift: Shift image intensity by constant 6950 6951 Syntax: `-shift <constant>` 6952 6953 Adds the given constant to every voxel. 6954 6955 c3d img1.img -shift 100 -o img2.img. 6956 """ 6957 shift: str 6958 """-shift: Shift image intensity by constant 6959 6960 Syntax: `-shift <constant>` 6961 6962 Adds the given constant to every voxel. 6963 6964 c3d img1.img -shift 100 -o img2.img""" 6965 6966 def run( 6967 self, 6968 execution: Execution, 6969 ) -> list[str]: 6970 """ 6971 Build command line arguments. This method is called by the main command. 6972 6973 Args: 6974 execution: The execution object. 6975 Returns: 6976 Command line arguments 6977 """ 6978 cargs = [] 6979 cargs.extend([ 6980 "-shift", 6981 self.shift 6982 ]) 6983 return cargs
-shift: Shift image intensity by constant
Syntax: -shift <constant>
Adds the given constant to every voxel.
c3d img1.img -shift 100 -o img2.img.
-shift: Shift image intensity by constant
Syntax: -shift <constant>
Adds the given constant to every voxel.
c3d img1.img -shift 100 -o img2.img
6966 def run( 6967 self, 6968 execution: Execution, 6969 ) -> list[str]: 6970 """ 6971 Build command line arguments. This method is called by the main command. 6972 6973 Args: 6974 execution: The execution object. 6975 Returns: 6976 Command line arguments 6977 """ 6978 cargs = [] 6979 cargs.extend([ 6980 "-shift", 6981 self.shift 6982 ]) 6983 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6986@dataclasses.dataclass 6987class C3dSignedDistanceTransform: 6988 """ 6989 -sdt, -signed-distance-transform: Signed distance transform of a binary 6990 image 6991 6992 Syntax: `-sdt` 6993 6994 Computes the signed distance transform of a binary image. Voxels where the 6995 binary image is non-zero will have negative values and voxels where the 6996 binary image is zero will have negative values. The magnitude of the value 6997 will be the approximate Euclidean distance to the boundary of the object 6998 represented by the binary image. 6999 7000 c3d binary.img -sdt -o dist.img. 7001 """ 7002 signed_distance_transform: str 7003 """-sdt, -signed-distance-transform: Signed distance transform of a binary 7004 image 7005 7006 Syntax: `-sdt` 7007 7008 Computes the signed distance transform of a binary image. Voxels where the 7009 binary image is non-zero will have negative values and voxels where the 7010 binary image is zero will have negative values. The magnitude of the value 7011 will be the approximate Euclidean distance to the boundary of the object 7012 represented by the binary image. 7013 7014 c3d binary.img -sdt -o dist.img""" 7015 7016 def run( 7017 self, 7018 execution: Execution, 7019 ) -> list[str]: 7020 """ 7021 Build command line arguments. This method is called by the main command. 7022 7023 Args: 7024 execution: The execution object. 7025 Returns: 7026 Command line arguments 7027 """ 7028 cargs = [] 7029 cargs.extend([ 7030 "-signed-distance-transform", 7031 self.signed_distance_transform 7032 ]) 7033 return cargs
-sdt, -signed-distance-transform: Signed distance transform of a binary image
Syntax: -sdt
Computes the signed distance transform of a binary image. Voxels where the binary image is non-zero will have negative values and voxels where the binary image is zero will have negative values. The magnitude of the value will be the approximate Euclidean distance to the boundary of the object represented by the binary image.
c3d binary.img -sdt -o dist.img.
-sdt, -signed-distance-transform: Signed distance transform of a binary image
Syntax: -sdt
Computes the signed distance transform of a binary image. Voxels where the binary image is non-zero will have negative values and voxels where the binary image is zero will have negative values. The magnitude of the value will be the approximate Euclidean distance to the boundary of the object represented by the binary image.
c3d binary.img -sdt -o dist.img
7016 def run( 7017 self, 7018 execution: Execution, 7019 ) -> list[str]: 7020 """ 7021 Build command line arguments. This method is called by the main command. 7022 7023 Args: 7024 execution: The execution object. 7025 Returns: 7026 Command line arguments 7027 """ 7028 cargs = [] 7029 cargs.extend([ 7030 "-signed-distance-transform", 7031 self.signed_distance_transform 7032 ]) 7033 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6748@dataclasses.dataclass 6749class C3dSin: 6750 """ 6751 -cos: Voxelwise cosine 6752 6753 Syntax: `-sin` 6754 6755 Replaces the last image on the stack with the cosine trigonometric operation 6756 applied to all voxels. Input must be in radians. 6757 """ 6758 sin: str 6759 """-cos: Voxelwise cosine 6760 6761 Syntax: `-sin` 6762 6763 Replaces the last image on the stack with the cosine trigonometric operation 6764 applied to all voxels. Input must be in radians.""" 6765 6766 def run( 6767 self, 6768 execution: Execution, 6769 ) -> list[str]: 6770 """ 6771 Build command line arguments. This method is called by the main command. 6772 6773 Args: 6774 execution: The execution object. 6775 Returns: 6776 Command line arguments 6777 """ 6778 cargs = [] 6779 cargs.extend([ 6780 "-sin", 6781 self.sin 6782 ]) 6783 return cargs
-cos: Voxelwise cosine
Syntax: -sin
Replaces the last image on the stack with the cosine trigonometric operation applied to all voxels. Input must be in radians.
-cos: Voxelwise cosine
Syntax: -sin
Replaces the last image on the stack with the cosine trigonometric operation applied to all voxels. Input must be in radians.
6766 def run( 6767 self, 6768 execution: Execution, 6769 ) -> list[str]: 6770 """ 6771 Build command line arguments. This method is called by the main command. 6772 6773 Args: 6774 execution: The execution object. 6775 Returns: 6776 Command line arguments 6777 """ 6778 cargs = [] 6779 cargs.extend([ 6780 "-sin", 6781 self.sin 6782 ]) 6783 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6786@dataclasses.dataclass 6787class C3dSlice: 6788 """ 6789 -slice: Extract slices from an image 6790 6791 Syntax: `-slice axis position_spec` 6792 6793 Extracts a slice along the specified axis (x,y or z). The position specifier 6794 **position_spec** can be a single slice or a range of slices. For a single 6795 slice, it can be specified as a number or a percentage. Numbering is 6796 zero-based, i.e, the first slice is slice 0, the last slice is N-1, where N 6797 is the number of slices. For a range, use MATLAB notation first:step:last. 6798 The slice is placed on the stack as an image with size 1 in the last 6799 dimension. You can save the slice as a 2D PNG image. 6800 6801 c3d input.img -slice x 128 -o myslice.nii.gz 6802 c3d input.img -slice y 50% myslice.nii.gz 6803 c3d input.img -slice z 25% -type uchar -stretch 0 2000 0 255 -o myslice.png 6804 c3d input.img -slice z 0:-1 -oo slice%0d.nii.gz 6805 c3d input.img -slice z 20%:10%:80% -oo slice%0d.nii.gz 6806 6807 With the new command **c4d**, the **-slice** command can be used to extract 6808 volumes from a 4D image. This can be useful to reformat a 4D NIFTI image as 6809 a 3D multi-component NIFTI image, using the command 6810 6811 c4d input4d.nii.gz -slice w 0:-1 -omc output3d_multicomp.nii.gz. 6812 """ 6813 slice_: str 6814 """-slice: Extract slices from an image 6815 6816 Syntax: `-slice axis position_spec` 6817 6818 Extracts a slice along the specified axis (x,y or z). The position specifier 6819 **position_spec** can be a single slice or a range of slices. For a single 6820 slice, it can be specified as a number or a percentage. Numbering is 6821 zero-based, i.e, the first slice is slice 0, the last slice is N-1, where N 6822 is the number of slices. For a range, use MATLAB notation first:step:last. 6823 The slice is placed on the stack as an image with size 1 in the last 6824 dimension. You can save the slice as a 2D PNG image. 6825 6826 c3d input.img -slice x 128 -o myslice.nii.gz 6827 c3d input.img -slice y 50% myslice.nii.gz 6828 c3d input.img -slice z 25% -type uchar -stretch 0 2000 0 255 -o myslice.png 6829 c3d input.img -slice z 0:-1 -oo slice%0d.nii.gz 6830 c3d input.img -slice z 20%:10%:80% -oo slice%0d.nii.gz 6831 6832 With the new command **c4d**, the **-slice** command can be used to extract 6833 volumes from a 4D image. This can be useful to reformat a 4D NIFTI image as 6834 a 3D multi-component NIFTI image, using the command 6835 6836 c4d input4d.nii.gz -slice w 0:-1 -omc output3d_multicomp.nii.gz""" 6837 6838 def run( 6839 self, 6840 execution: Execution, 6841 ) -> list[str]: 6842 """ 6843 Build command line arguments. This method is called by the main command. 6844 6845 Args: 6846 execution: The execution object. 6847 Returns: 6848 Command line arguments 6849 """ 6850 cargs = [] 6851 cargs.extend([ 6852 "-slice", 6853 self.slice_ 6854 ]) 6855 return cargs
-slice: Extract slices from an image
Syntax: -slice axis position_spec
Extracts a slice along the specified axis (x,y or z). The position specifier position_spec can be a single slice or a range of slices. For a single slice, it can be specified as a number or a percentage. Numbering is zero-based, i.e, the first slice is slice 0, the last slice is N-1, where N is the number of slices. For a range, use MATLAB notation first:step:last. The slice is placed on the stack as an image with size 1 in the last dimension. You can save the slice as a 2D PNG image.
c3d input.img -slice x 128 -o myslice.nii.gz c3d input.img -slice y 50% myslice.nii.gz c3d input.img -slice z 25% -type uchar -stretch 0 2000 0 255 -o myslice.png c3d input.img -slice z 0:-1 -oo slice%0d.nii.gz c3d input.img -slice z 20%:10%:80% -oo slice%0d.nii.gz
With the new command c4d, the -slice command can be used to extract volumes from a 4D image. This can be useful to reformat a 4D NIFTI image as a 3D multi-component NIFTI image, using the command
c4d input4d.nii.gz -slice w 0:-1 -omc output3d_multicomp.nii.gz.
-slice: Extract slices from an image
Syntax: -slice axis position_spec
Extracts a slice along the specified axis (x,y or z). The position specifier position_spec can be a single slice or a range of slices. For a single slice, it can be specified as a number or a percentage. Numbering is zero-based, i.e, the first slice is slice 0, the last slice is N-1, where N is the number of slices. For a range, use MATLAB notation first:step:last. The slice is placed on the stack as an image with size 1 in the last dimension. You can save the slice as a 2D PNG image.
c3d input.img -slice x 128 -o myslice.nii.gz c3d input.img -slice y 50% myslice.nii.gz c3d input.img -slice z 25% -type uchar -stretch 0 2000 0 255 -o myslice.png c3d input.img -slice z 0:-1 -oo slice%0d.nii.gz c3d input.img -slice z 20%:10%:80% -oo slice%0d.nii.gz
With the new command c4d, the -slice command can be used to extract volumes from a 4D image. This can be useful to reformat a 4D NIFTI image as a 3D multi-component NIFTI image, using the command
c4d input4d.nii.gz -slice w 0:-1 -omc output3d_multicomp.nii.gz
6838 def run( 6839 self, 6840 execution: Execution, 6841 ) -> list[str]: 6842 """ 6843 Build command line arguments. This method is called by the main command. 6844 6845 Args: 6846 execution: The execution object. 6847 Returns: 6848 Command line arguments 6849 """ 6850 cargs = [] 6851 cargs.extend([ 6852 "-slice", 6853 self.slice_ 6854 ]) 6855 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
6858@dataclasses.dataclass 6859class C3dSliceAll: 6860 """ 6861 -slice-all: Extract slices from all images on the stack 6862 6863 Syntax `-slice-all axis position_spec` 6864 6865 This command behaves identical to the **-slice** command, but all images on 6866 the stack are sliced, and the slices are interleaved. This is useful for 6867 slicing multi-component images. For example, if you read a four-component 6868 image 'test4.nii.gz', you can extract and save the slices as follows: 6869 6870 c3d test4.nii.gz -slice-all 20%:10%:80% -oomc 4 slice4_%03d.nii.gz. 6871 """ 6872 slice_all: str 6873 """-slice-all: Extract slices from all images on the stack 6874 6875 Syntax `-slice-all axis position_spec` 6876 6877 This command behaves identical to the **-slice** command, but all images on 6878 the stack are sliced, and the slices are interleaved. This is useful for 6879 slicing multi-component images. For example, if you read a four-component 6880 image 'test4.nii.gz', you can extract and save the slices as follows: 6881 6882 c3d test4.nii.gz -slice-all 20%:10%:80% -oomc 4 slice4_%03d.nii.gz""" 6883 6884 def run( 6885 self, 6886 execution: Execution, 6887 ) -> list[str]: 6888 """ 6889 Build command line arguments. This method is called by the main command. 6890 6891 Args: 6892 execution: The execution object. 6893 Returns: 6894 Command line arguments 6895 """ 6896 cargs = [] 6897 cargs.extend([ 6898 "-slice-all", 6899 self.slice_all 6900 ]) 6901 return cargs
-slice-all: Extract slices from all images on the stack
Syntax -slice-all axis position_spec
This command behaves identical to the -slice command, but all images on the stack are sliced, and the slices are interleaved. This is useful for slicing multi-component images. For example, if you read a four-component image 'test4.nii.gz', you can extract and save the slices as follows:
c3d test4.nii.gz -slice-all 20%:10%:80% -oomc 4 slice4_%03d.nii.gz.
-slice-all: Extract slices from all images on the stack
Syntax -slice-all axis position_spec
This command behaves identical to the -slice command, but all images on the stack are sliced, and the slices are interleaved. This is useful for slicing multi-component images. For example, if you read a four-component image 'test4.nii.gz', you can extract and save the slices as follows:
c3d test4.nii.gz -slice-all 20%:10%:80% -oomc 4 slice4_%03d.nii.gz
6884 def run( 6885 self, 6886 execution: Execution, 6887 ) -> list[str]: 6888 """ 6889 Build command line arguments. This method is called by the main command. 6890 6891 Args: 6892 execution: The execution object. 6893 Returns: 6894 Command line arguments 6895 """ 6896 cargs = [] 6897 cargs.extend([ 6898 "-slice-all", 6899 self.slice_all 6900 ]) 6901 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7036@dataclasses.dataclass 7037class C3dSmooth: 7038 """ 7039 -smooth: Gaussian smoothing 7040 7041 Syntax: `-smooth <sigma_vector> ` 7042 7043 Applies Gaussian smoothing to the image. The parameter vector specifies the 7044 standard deviation of the Gaussian kernel. Also see [Vector Format 7045 Specification][10] below. 7046 7047 c3d img1.img -smooth 2x1x1vox -o out.img. 7048 """ 7049 smooth: str 7050 """-smooth: Gaussian smoothing 7051 7052 Syntax: `-smooth <sigma_vector> ` 7053 7054 Applies Gaussian smoothing to the image. The parameter vector specifies the 7055 standard deviation of the Gaussian kernel. Also see [Vector Format 7056 Specification][10] below. 7057 7058 c3d img1.img -smooth 2x1x1vox -o out.img""" 7059 7060 def run( 7061 self, 7062 execution: Execution, 7063 ) -> list[str]: 7064 """ 7065 Build command line arguments. This method is called by the main command. 7066 7067 Args: 7068 execution: The execution object. 7069 Returns: 7070 Command line arguments 7071 """ 7072 cargs = [] 7073 cargs.extend([ 7074 "-smooth", 7075 self.smooth 7076 ]) 7077 return cargs
-smooth: Gaussian smoothing
Syntax: -smooth <sigma_vector>
Applies Gaussian smoothing to the image. The parameter vector specifies the standard deviation of the Gaussian kernel. Also see [Vector Format Specification][10] below.
c3d img1.img -smooth 2x1x1vox -o out.img.
-smooth: Gaussian smoothing
Syntax: -smooth <sigma_vector>
Applies Gaussian smoothing to the image. The parameter vector specifies the standard deviation of the Gaussian kernel. Also see [Vector Format Specification][10] below.
c3d img1.img -smooth 2x1x1vox -o out.img
7060 def run( 7061 self, 7062 execution: Execution, 7063 ) -> list[str]: 7064 """ 7065 Build command line arguments. This method is called by the main command. 7066 7067 Args: 7068 execution: The execution object. 7069 Returns: 7070 Command line arguments 7071 """ 7072 cargs = [] 7073 cargs.extend([ 7074 "-smooth", 7075 self.smooth 7076 ]) 7077 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7080@dataclasses.dataclass 7081class C3dSmoothFast: 7082 """ 7083 -smooth-fast: Fast approximate Gaussian smoothing 7084 7085 Syntax: `-smooth-fast <sigma_vector> ` 7086 7087 Applies Gaussian smoothing to the image using the fast [Deriche recursive 7088 smoothing algorithm][15]. The parameter vector specifies the standard 7089 deviation of the Gaussian kernel. Also see [Vector Format Specification][10] 7090 below. 7091 7092 c3d img1.img -smooth-fast 20x10x10vox -o out.img. 7093 """ 7094 smooth_fast: str 7095 """-smooth-fast: Fast approximate Gaussian smoothing 7096 7097 Syntax: `-smooth-fast <sigma_vector> ` 7098 7099 Applies Gaussian smoothing to the image using the fast [Deriche recursive 7100 smoothing algorithm][15]. The parameter vector specifies the standard 7101 deviation of the Gaussian kernel. Also see [Vector Format Specification][10] 7102 below. 7103 7104 c3d img1.img -smooth-fast 20x10x10vox -o out.img""" 7105 7106 def run( 7107 self, 7108 execution: Execution, 7109 ) -> list[str]: 7110 """ 7111 Build command line arguments. This method is called by the main command. 7112 7113 Args: 7114 execution: The execution object. 7115 Returns: 7116 Command line arguments 7117 """ 7118 cargs = [] 7119 cargs.extend([ 7120 "-smooth-fast", 7121 self.smooth_fast 7122 ]) 7123 return cargs
-smooth-fast: Fast approximate Gaussian smoothing
Syntax: -smooth-fast <sigma_vector>
Applies Gaussian smoothing to the image using the fast [Deriche recursive smoothing algorithm][15]. The parameter vector specifies the standard deviation of the Gaussian kernel. Also see [Vector Format Specification][10] below.
c3d img1.img -smooth-fast 20x10x10vox -o out.img.
-smooth-fast: Fast approximate Gaussian smoothing
Syntax: -smooth-fast <sigma_vector>
Applies Gaussian smoothing to the image using the fast [Deriche recursive smoothing algorithm][15]. The parameter vector specifies the standard deviation of the Gaussian kernel. Also see [Vector Format Specification][10] below.
c3d img1.img -smooth-fast 20x10x10vox -o out.img
7106 def run( 7107 self, 7108 execution: Execution, 7109 ) -> list[str]: 7110 """ 7111 Build command line arguments. This method is called by the main command. 7112 7113 Args: 7114 execution: The execution object. 7115 Returns: 7116 Command line arguments 7117 """ 7118 cargs = [] 7119 cargs.extend([ 7120 "-smooth-fast", 7121 self.smooth_fast 7122 ]) 7123 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7126@dataclasses.dataclass 7127class C3dSpacing: 7128 """ 7129 -spacing: Set voxel spacing 7130 7131 Syntax: `-spacing <vector> ` 7132 7133 Sets the voxel spacing of the image. This should always be a vector with 7134 positive components. For example, to set the spacing of the image to 1mm 7135 isotropic, use the command below. This command only changes the header of 7136 the image, not its contents. 7137 7138 c3d img.nii -spacing 1x1x1mm -o out.img. 7139 """ 7140 spacing: str 7141 """-spacing: Set voxel spacing 7142 7143 Syntax: `-spacing <vector> ` 7144 7145 Sets the voxel spacing of the image. This should always be a vector with 7146 positive components. For example, to set the spacing of the image to 1mm 7147 isotropic, use the command below. This command only changes the header of 7148 the image, not its contents. 7149 7150 c3d img.nii -spacing 1x1x1mm -o out.img""" 7151 7152 def run( 7153 self, 7154 execution: Execution, 7155 ) -> list[str]: 7156 """ 7157 Build command line arguments. This method is called by the main command. 7158 7159 Args: 7160 execution: The execution object. 7161 Returns: 7162 Command line arguments 7163 """ 7164 cargs = [] 7165 cargs.extend([ 7166 "-spacing", 7167 self.spacing 7168 ]) 7169 return cargs
-spacing: Set voxel spacing
Syntax: -spacing <vector>
Sets the voxel spacing of the image. This should always be a vector with positive components. For example, to set the spacing of the image to 1mm isotropic, use the command below. This command only changes the header of the image, not its contents.
c3d img.nii -spacing 1x1x1mm -o out.img.
-spacing: Set voxel spacing
Syntax: -spacing <vector>
Sets the voxel spacing of the image. This should always be a vector with positive components. For example, to set the spacing of the image to 1mm isotropic, use the command below. This command only changes the header of the image, not its contents.
c3d img.nii -spacing 1x1x1mm -o out.img
7152 def run( 7153 self, 7154 execution: Execution, 7155 ) -> list[str]: 7156 """ 7157 Build command line arguments. This method is called by the main command. 7158 7159 Args: 7160 execution: The execution object. 7161 Returns: 7162 Command line arguments 7163 """ 7164 cargs = [] 7165 cargs.extend([ 7166 "-spacing", 7167 self.spacing 7168 ]) 7169 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7172@dataclasses.dataclass 7173class C3dSplit: 7174 """ 7175 -split: Split multi-label image into binary images 7176 7177 Syntax: `-split` 7178 7179 This command takes a multilabel image (one with a small number of discrete 7180 intensity levels), and replaces it with a set of binary images, one for each 7181 of the levels. The images can later be recombined using the **-merge** 7182 command. The labels corresponding to each binary image are remembered by 7183 **convert3d** so that when **-merge** is called, the labels are faithfully 7184 reassigned. The **-merge** command treats each input as a probability image, 7185 and selects at each voxel the label that has highest probability. The 7186 example below smooths each label independently, then recombines using 7187 **-merge** 7188 7189 c3d multilabel.nii -split -foreach -smooth 3mm -endfor -merge -o 7190 ml_smooth.nii 7191 7192 Also of note is that the **-split** command will disregard infinite 7193 intensity values. So if you want to apply voting to a subset of the labels, 7194 you can replace labels you do not care about with *inf*, for example, using 7195 the **-thresh** command. 7196 """ 7197 split: str 7198 """-split: Split multi-label image into binary images 7199 7200 Syntax: `-split` 7201 7202 This command takes a multilabel image (one with a small number of discrete 7203 intensity levels), and replaces it with a set of binary images, one for each 7204 of the levels. The images can later be recombined using the **-merge** 7205 command. The labels corresponding to each binary image are remembered by 7206 **convert3d** so that when **-merge** is called, the labels are faithfully 7207 reassigned. The **-merge** command treats each input as a probability image, 7208 and selects at each voxel the label that has highest probability. The 7209 example below smooths each label independently, then recombines using 7210 **-merge** 7211 7212 c3d multilabel.nii -split -foreach -smooth 3mm -endfor -merge -o 7213 ml_smooth.nii 7214 7215 Also of note is that the **-split** command will disregard infinite 7216 intensity values. So if you want to apply voting to a subset of the labels, 7217 you can replace labels you do not care about with *inf*, for example, using 7218 the **-thresh** command.""" 7219 7220 def run( 7221 self, 7222 execution: Execution, 7223 ) -> list[str]: 7224 """ 7225 Build command line arguments. This method is called by the main command. 7226 7227 Args: 7228 execution: The execution object. 7229 Returns: 7230 Command line arguments 7231 """ 7232 cargs = [] 7233 cargs.extend([ 7234 "-split", 7235 self.split 7236 ]) 7237 return cargs
-split: Split multi-label image into binary images
Syntax: -split
This command takes a multilabel image (one with a small number of discrete intensity levels), and replaces it with a set of binary images, one for each of the levels. The images can later be recombined using the -merge command. The labels corresponding to each binary image are remembered by convert3d so that when -merge is called, the labels are faithfully reassigned. The -merge command treats each input as a probability image, and selects at each voxel the label that has highest probability. The example below smooths each label independently, then recombines using -merge
c3d multilabel.nii -split -foreach -smooth 3mm -endfor -merge -o ml_smooth.nii
Also of note is that the -split command will disregard infinite intensity values. So if you want to apply voting to a subset of the labels, you can replace labels you do not care about with inf, for example, using the -thresh command.
-split: Split multi-label image into binary images
Syntax: -split
This command takes a multilabel image (one with a small number of discrete intensity levels), and replaces it with a set of binary images, one for each of the levels. The images can later be recombined using the -merge command. The labels corresponding to each binary image are remembered by convert3d so that when -merge is called, the labels are faithfully reassigned. The -merge command treats each input as a probability image, and selects at each voxel the label that has highest probability. The example below smooths each label independently, then recombines using -merge
c3d multilabel.nii -split -foreach -smooth 3mm -endfor -merge -o ml_smooth.nii
Also of note is that the -split command will disregard infinite intensity values. So if you want to apply voting to a subset of the labels, you can replace labels you do not care about with inf, for example, using the -thresh command.
7220 def run( 7221 self, 7222 execution: Execution, 7223 ) -> list[str]: 7224 """ 7225 Build command line arguments. This method is called by the main command. 7226 7227 Args: 7228 execution: The execution object. 7229 Returns: 7230 Command line arguments 7231 """ 7232 cargs = [] 7233 cargs.extend([ 7234 "-split", 7235 self.split 7236 ]) 7237 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7400@dataclasses.dataclass 7401class C3dSpm: 7402 """ 7403 -spm, -nospm: SPM compatibility in Analyze output 7404 7405 Syntax: `-spm` or `-nospm ` 7406 7407 These options specify whether use the SPM extension to the Analyze 7408 (.hdr,.img) format. When this option is on, the origin field stored by SPM 7409 in the Analyze header will be correctly interpreted. When saving analyze 7410 files, the origin will be set correctly. The default is equivalent to the 7411 **-nospm** option. Best to avoid this issue altogether by using NIFTI and 7412 SPM5 or later. 7413 7414 c3d -spm in.hdr out.img.gz. 7415 """ 7416 spm: str 7417 """-spm, -nospm: SPM compatibility in Analyze output 7418 7419 Syntax: `-spm` or `-nospm ` 7420 7421 These options specify whether use the SPM extension to the Analyze 7422 (.hdr,.img) format. When this option is on, the origin field stored by SPM 7423 in the Analyze header will be correctly interpreted. When saving analyze 7424 files, the origin will be set correctly. The default is equivalent to the 7425 **-nospm** option. Best to avoid this issue altogether by using NIFTI and 7426 SPM5 or later. 7427 7428 c3d -spm in.hdr out.img.gz""" 7429 7430 def run( 7431 self, 7432 execution: Execution, 7433 ) -> list[str]: 7434 """ 7435 Build command line arguments. This method is called by the main command. 7436 7437 Args: 7438 execution: The execution object. 7439 Returns: 7440 Command line arguments 7441 """ 7442 cargs = [] 7443 cargs.extend([ 7444 "-spm", 7445 self.spm 7446 ]) 7447 return cargs
-spm, -nospm: SPM compatibility in Analyze output
Syntax: -spm or -nospm
These options specify whether use the SPM extension to the Analyze (.hdr,.img) format. When this option is on, the origin field stored by SPM in the Analyze header will be correctly interpreted. When saving analyze files, the origin will be set correctly. The default is equivalent to the -nospm option. Best to avoid this issue altogether by using NIFTI and SPM5 or later.
c3d -spm in.hdr out.img.gz.
-spm, -nospm: SPM compatibility in Analyze output
Syntax: -spm or -nospm
These options specify whether use the SPM extension to the Analyze (.hdr,.img) format. When this option is on, the origin field stored by SPM in the Analyze header will be correctly interpreted. When saving analyze files, the origin will be set correctly. The default is equivalent to the -nospm option. Best to avoid this issue altogether by using NIFTI and SPM5 or later.
c3d -spm in.hdr out.img.gz
7430 def run( 7431 self, 7432 execution: Execution, 7433 ) -> list[str]: 7434 """ 7435 Build command line arguments. This method is called by the main command. 7436 7437 Args: 7438 execution: The execution object. 7439 Returns: 7440 Command line arguments 7441 """ 7442 cargs = [] 7443 cargs.extend([ 7444 "-spm", 7445 self.spm 7446 ]) 7447 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7240@dataclasses.dataclass 7241class C3dSqrt: 7242 """ 7243 -sqrt: Take square root of image 7244 7245 Syntax: `-sqrt ` 7246 7247 Computes square root of each voxel in the image. 7248 7249 c3d input.img -sqrt -o output.img. 7250 """ 7251 sqrt: str 7252 """-sqrt: Take square root of image 7253 7254 Syntax: `-sqrt ` 7255 7256 Computes square root of each voxel in the image. 7257 7258 c3d input.img -sqrt -o output.img""" 7259 7260 def run( 7261 self, 7262 execution: Execution, 7263 ) -> list[str]: 7264 """ 7265 Build command line arguments. This method is called by the main command. 7266 7267 Args: 7268 execution: The execution object. 7269 Returns: 7270 Command line arguments 7271 """ 7272 cargs = [] 7273 cargs.extend([ 7274 "-sqrt", 7275 self.sqrt 7276 ]) 7277 return cargs
-sqrt: Take square root of image
Syntax: -sqrt
Computes square root of each voxel in the image.
c3d input.img -sqrt -o output.img.
-sqrt: Take square root of image
Syntax: -sqrt
Computes square root of each voxel in the image.
c3d input.img -sqrt -o output.img
7260 def run( 7261 self, 7262 execution: Execution, 7263 ) -> list[str]: 7264 """ 7265 Build command line arguments. This method is called by the main command. 7266 7267 Args: 7268 execution: The execution object. 7269 Returns: 7270 Command line arguments 7271 """ 7272 cargs = [] 7273 cargs.extend([ 7274 "-sqrt", 7275 self.sqrt 7276 ]) 7277 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7280@dataclasses.dataclass 7281class C3dStaple: 7282 """ 7283 -staple: STAPLE algorithm to combine segmentations 7284 7285 Syntax: `-staple <intensity_value> ` 7286 7287 Runs the ITK implementation of the STAPLE algorithm ([See Paper][11]). 7288 STAPLE generates an estimate of the 'true' segmentation of a structure given 7289 a set of segmentations by different raters. This command treats all images 7290 on the stack as inputs. Each image is considered to be a segmentation by a 7291 different rater. The parameter *intensity_value* specifies the label in the 7292 segmentation images corresponding to the structure of interest (e.g., the 7293 segmentation image may have value 1 corresponding to the caudate and value 2 7294 corresponding to the hippocampus. To run STAPLE on the hippocampus, pass in 7295 2 as the *intensity_value*). The output of STAPLE is a real-valued image 7296 with voxels between 0 and 1, representing the probability of each voxel 7297 being in the 'true' segmentation. This image can be thresholded to get a 7298 binary consensus segmentation. Additional outputs (estimates of the 7299 sensitivity and specificity of each rater) are printed out if the 7300 **-verbose** command is used before the **-staple** command. 7301 7302 c3d -verbose rater1.img rater2.img rater3.img -staple 1 -o probmap.img 7303 c3d -verbose rater*.img -staple 1 -threshold 0.5 inf 1 0 -o bin_segm.img. 7304 """ 7305 staple: str 7306 """-staple: STAPLE algorithm to combine segmentations 7307 7308 Syntax: `-staple <intensity_value> ` 7309 7310 Runs the ITK implementation of the STAPLE algorithm ([See Paper][11]). 7311 STAPLE generates an estimate of the 'true' segmentation of a structure given 7312 a set of segmentations by different raters. This command treats all images 7313 on the stack as inputs. Each image is considered to be a segmentation by a 7314 different rater. The parameter *intensity_value* specifies the label in the 7315 segmentation images corresponding to the structure of interest (e.g., the 7316 segmentation image may have value 1 corresponding to the caudate and value 2 7317 corresponding to the hippocampus. To run STAPLE on the hippocampus, pass in 7318 2 as the *intensity_value*). The output of STAPLE is a real-valued image 7319 with voxels between 0 and 1, representing the probability of each voxel 7320 being in the 'true' segmentation. This image can be thresholded to get a 7321 binary consensus segmentation. Additional outputs (estimates of the 7322 sensitivity and specificity of each rater) are printed out if the 7323 **-verbose** command is used before the **-staple** command. 7324 7325 c3d -verbose rater1.img rater2.img rater3.img -staple 1 -o probmap.img 7326 c3d -verbose rater*.img -staple 1 -threshold 0.5 inf 1 0 -o bin_segm.img""" 7327 7328 def run( 7329 self, 7330 execution: Execution, 7331 ) -> list[str]: 7332 """ 7333 Build command line arguments. This method is called by the main command. 7334 7335 Args: 7336 execution: The execution object. 7337 Returns: 7338 Command line arguments 7339 """ 7340 cargs = [] 7341 cargs.extend([ 7342 "-staple", 7343 self.staple 7344 ]) 7345 return cargs
-staple: STAPLE algorithm to combine segmentations
Syntax: -staple <intensity_value>
Runs the ITK implementation of the STAPLE algorithm ([See Paper][11]). STAPLE generates an estimate of the 'true' segmentation of a structure given a set of segmentations by different raters. This command treats all images on the stack as inputs. Each image is considered to be a segmentation by a different rater. The parameter intensity_value specifies the label in the segmentation images corresponding to the structure of interest (e.g., the segmentation image may have value 1 corresponding to the caudate and value 2 corresponding to the hippocampus. To run STAPLE on the hippocampus, pass in 2 as the intensity_value). The output of STAPLE is a real-valued image with voxels between 0 and 1, representing the probability of each voxel being in the 'true' segmentation. This image can be thresholded to get a binary consensus segmentation. Additional outputs (estimates of the sensitivity and specificity of each rater) are printed out if the -verbose command is used before the -staple command.
c3d -verbose rater1.img rater2.img rater3.img -staple 1 -o probmap.img c3d -verbose rater*.img -staple 1 -threshold 0.5 inf 1 0 -o bin_segm.img.
-staple: STAPLE algorithm to combine segmentations
Syntax: -staple <intensity_value>
Runs the ITK implementation of the STAPLE algorithm ([See Paper][11]). STAPLE generates an estimate of the 'true' segmentation of a structure given a set of segmentations by different raters. This command treats all images on the stack as inputs. Each image is considered to be a segmentation by a different rater. The parameter intensity_value specifies the label in the segmentation images corresponding to the structure of interest (e.g., the segmentation image may have value 1 corresponding to the caudate and value 2 corresponding to the hippocampus. To run STAPLE on the hippocampus, pass in 2 as the intensity_value). The output of STAPLE is a real-valued image with voxels between 0 and 1, representing the probability of each voxel being in the 'true' segmentation. This image can be thresholded to get a binary consensus segmentation. Additional outputs (estimates of the sensitivity and specificity of each rater) are printed out if the -verbose command is used before the -staple command.
c3d -verbose rater1.img rater2.img rater3.img -staple 1 -o probmap.img c3d -verbose rater*.img -staple 1 -threshold 0.5 inf 1 0 -o bin_segm.img
7328 def run( 7329 self, 7330 execution: Execution, 7331 ) -> list[str]: 7332 """ 7333 Build command line arguments. This method is called by the main command. 7334 7335 Args: 7336 execution: The execution object. 7337 Returns: 7338 Command line arguments 7339 """ 7340 cargs = [] 7341 cargs.extend([ 7342 "-staple", 7343 self.staple 7344 ]) 7345 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7506@dataclasses.dataclass 7507class C3dStretch: 7508 """ 7509 -stretch: Stretch image intensities linearly 7510 7511 Syntax: `-stretch <u1 u2 v1 v2> ` 7512 7513 Stretches the intensities in the image linearly, such that u1 maps to v1 and 7514 u2 maps to v2. The linear transformation is applied to all intensities in 7515 the image, whether inside the range or not. For example, to map a floating 7516 point image with intensities in interval (0,1) to the full range of an 7517 unsigned short image, use 7518 7519 c3d input.img -stretch 0.0 1.0 0 65535 -type ushort -o output.img. 7520 """ 7521 stretch: str 7522 """-stretch: Stretch image intensities linearly 7523 7524 Syntax: `-stretch <u1 u2 v1 v2> ` 7525 7526 Stretches the intensities in the image linearly, such that u1 maps to v1 and 7527 u2 maps to v2. The linear transformation is applied to all intensities in 7528 the image, whether inside the range or not. For example, to map a floating 7529 point image with intensities in interval (0,1) to the full range of an 7530 unsigned short image, use 7531 7532 c3d input.img -stretch 0.0 1.0 0 65535 -type ushort -o output.img""" 7533 7534 def run( 7535 self, 7536 execution: Execution, 7537 ) -> list[str]: 7538 """ 7539 Build command line arguments. This method is called by the main command. 7540 7541 Args: 7542 execution: The execution object. 7543 Returns: 7544 Command line arguments 7545 """ 7546 cargs = [] 7547 cargs.extend([ 7548 "-stretch", 7549 self.stretch 7550 ]) 7551 return cargs
-stretch: Stretch image intensities linearly
Syntax: -stretch <u1 u2 v1 v2>
Stretches the intensities in the image linearly, such that u1 maps to v1 and u2 maps to v2. The linear transformation is applied to all intensities in the image, whether inside the range or not. For example, to map a floating point image with intensities in interval (0,1) to the full range of an unsigned short image, use
c3d input.img -stretch 0.0 1.0 0 65535 -type ushort -o output.img.
-stretch: Stretch image intensities linearly
Syntax: -stretch <u1 u2 v1 v2>
Stretches the intensities in the image linearly, such that u1 maps to v1 and u2 maps to v2. The linear transformation is applied to all intensities in the image, whether inside the range or not. For example, to map a floating point image with intensities in interval (0,1) to the full range of an unsigned short image, use
c3d input.img -stretch 0.0 1.0 0 65535 -type ushort -o output.img
7534 def run( 7535 self, 7536 execution: Execution, 7537 ) -> list[str]: 7538 """ 7539 Build command line arguments. This method is called by the main command. 7540 7541 Args: 7542 execution: The execution object. 7543 Returns: 7544 Command line arguments 7545 """ 7546 cargs = [] 7547 cargs.extend([ 7548 "-stretch", 7549 self.stretch 7550 ]) 7551 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7348@dataclasses.dataclass 7349class C3dStructureTensorEigenvalues: 7350 """ 7351 -steig, -structure-tensor-eigenvalues: Compute eigenvalues of the structure 7352 tensor 7353 7354 Syntax `-steig <scale> <radius>` 7355 7356 Computes the Hessian matrix at every pixel of an image and the eigenvalues 7357 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 7358 the stack. These images are useful as texture features. See also the 7359 '''-steig''' command. The scale determines the amount of Gaussian smoothing 7360 applied for computing the partial derivatives in the Hessian, and is in 7361 physical (mm) units. 7362 7363 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz. 7364 """ 7365 structure_tensor_eigenvalues: str 7366 """-steig, -structure-tensor-eigenvalues: Compute eigenvalues of the 7367 structure tensor 7368 7369 Syntax `-steig <scale> <radius>` 7370 7371 Computes the Hessian matrix at every pixel of an image and the eigenvalues 7372 of the Hessian. Images of the eigenvalues (sorted by value) are placed on 7373 the stack. These images are useful as texture features. See also the 7374 '''-steig''' command. The scale determines the amount of Gaussian smoothing 7375 applied for computing the partial derivatives in the Hessian, and is in 7376 physical (mm) units. 7377 7378 c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz""" 7379 7380 def run( 7381 self, 7382 execution: Execution, 7383 ) -> list[str]: 7384 """ 7385 Build command line arguments. This method is called by the main command. 7386 7387 Args: 7388 execution: The execution object. 7389 Returns: 7390 Command line arguments 7391 """ 7392 cargs = [] 7393 cargs.extend([ 7394 "-steig", 7395 self.structure_tensor_eigenvalues 7396 ]) 7397 return cargs
-steig, -structure-tensor-eigenvalues: Compute eigenvalues of the structure tensor
Syntax -steig <scale> <radius>
Computes the Hessian matrix at every pixel of an image and the eigenvalues of the Hessian. Images of the eigenvalues (sorted by value) are placed on the stack. These images are useful as texture features. See also the '''-steig''' command. The scale determines the amount of Gaussian smoothing applied for computing the partial derivatives in the Hessian, and is in physical (mm) units.
c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz.
-steig, -structure-tensor-eigenvalues: Compute eigenvalues of the structure tensor
Syntax -steig <scale> <radius>
Computes the Hessian matrix at every pixel of an image and the eigenvalues of the Hessian. Images of the eigenvalues (sorted by value) are placed on the stack. These images are useful as texture features. See also the '''-steig''' command. The scale determines the amount of Gaussian smoothing applied for computing the partial derivatives in the Hessian, and is in physical (mm) units.
c3d myimage.nii -hesseig 2.0 -oo eig%02d.nii.gz
7380 def run( 7381 self, 7382 execution: Execution, 7383 ) -> list[str]: 7384 """ 7385 Build command line arguments. This method is called by the main command. 7386 7387 Args: 7388 execution: The execution object. 7389 Returns: 7390 Command line arguments 7391 """ 7392 cargs = [] 7393 cargs.extend([ 7394 "-steig", 7395 self.structure_tensor_eigenvalues 7396 ]) 7397 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7450@dataclasses.dataclass 7451class C3dSubtract: 7452 """ 7453 No description found. 7454 """ 7455 subtract: str 7456 """No description found.""" 7457 7458 def run( 7459 self, 7460 execution: Execution, 7461 ) -> list[str]: 7462 """ 7463 Build command line arguments. This method is called by the main command. 7464 7465 Args: 7466 execution: The execution object. 7467 Returns: 7468 Command line arguments 7469 """ 7470 cargs = [] 7471 cargs.extend([ 7472 "-subtract", 7473 self.subtract 7474 ]) 7475 return cargs
No description found.
7458 def run( 7459 self, 7460 execution: Execution, 7461 ) -> list[str]: 7462 """ 7463 Build command line arguments. This method is called by the main command. 7464 7465 Args: 7466 execution: The execution object. 7467 Returns: 7468 Command line arguments 7469 """ 7470 cargs = [] 7471 cargs.extend([ 7472 "-subtract", 7473 self.subtract 7474 ]) 7475 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7478@dataclasses.dataclass 7479class C3dSupervoxel: 7480 """ 7481 No description found. 7482 """ 7483 supervoxel: str 7484 """No description found.""" 7485 7486 def run( 7487 self, 7488 execution: Execution, 7489 ) -> list[str]: 7490 """ 7491 Build command line arguments. This method is called by the main command. 7492 7493 Args: 7494 execution: The execution object. 7495 Returns: 7496 Command line arguments 7497 """ 7498 cargs = [] 7499 cargs.extend([ 7500 "-supervoxel", 7501 self.supervoxel 7502 ]) 7503 return cargs
No description found.
7486 def run( 7487 self, 7488 execution: Execution, 7489 ) -> list[str]: 7490 """ 7491 Build command line arguments. This method is called by the main command. 7492 7493 Args: 7494 execution: The execution object. 7495 Returns: 7496 Command line arguments 7497 """ 7498 cargs = [] 7499 cargs.extend([ 7500 "-supervoxel", 7501 self.supervoxel 7502 ]) 7503 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7554@dataclasses.dataclass 7555class C3dSwapdim: 7556 """ 7557 -swapdim: Reorder the coordinate axes of an image 7558 7559 Syntax `-swapdim <code>` 7560 7561 This command reorders the image axes (columns, rows, slices) to achieve a 7562 desired transformation between voxel space and physical space. The image 7563 remains exactly the same in physical space, but the encoding of the voxels 7564 in memory and on disk is changed to obtain the desired transformation. The 7565 transformation is specified as a three-letter 'RAI' code, as in the 7566 '''-orient''' command. 7567 7568 c3d img.nii -swapdim ASL -info -o out.nii 7569 7570 7571 ### Commands: Image Processing 7572 7573 The following commands invoke an action that is applied to images. Unary 7574 commands apply the action to the last image on the stack, binary commands 7575 apply to the last two images and so on. Commands are affected by options, 7576 which are listed separately. 7577 """ 7578 swapdim: str 7579 """-swapdim: Reorder the coordinate axes of an image 7580 7581 Syntax `-swapdim <code>` 7582 7583 This command reorders the image axes (columns, rows, slices) to achieve a 7584 desired transformation between voxel space and physical space. The image 7585 remains exactly the same in physical space, but the encoding of the voxels 7586 in memory and on disk is changed to obtain the desired transformation. The 7587 transformation is specified as a three-letter 'RAI' code, as in the 7588 '''-orient''' command. 7589 7590 c3d img.nii -swapdim ASL -info -o out.nii 7591 7592 7593 ### Commands: Image Processing 7594 7595 The following commands invoke an action that is applied to images. Unary 7596 commands apply the action to the last image on the stack, binary commands 7597 apply to the last two images and so on. Commands are affected by options, 7598 which are listed separately.""" 7599 7600 def run( 7601 self, 7602 execution: Execution, 7603 ) -> list[str]: 7604 """ 7605 Build command line arguments. This method is called by the main command. 7606 7607 Args: 7608 execution: The execution object. 7609 Returns: 7610 Command line arguments 7611 """ 7612 cargs = [] 7613 cargs.extend([ 7614 "-swapdim", 7615 self.swapdim 7616 ]) 7617 return cargs
-swapdim: Reorder the coordinate axes of an image
Syntax -swapdim <code>
This command reorders the image axes (columns, rows, slices) to achieve a desired transformation between voxel space and physical space. The image remains exactly the same in physical space, but the encoding of the voxels in memory and on disk is changed to obtain the desired transformation. The transformation is specified as a three-letter 'RAI' code, as in the '''-orient''' command.
c3d img.nii -swapdim ASL -info -o out.nii
Commands: Image Processing
The following commands invoke an action that is applied to images. Unary commands apply the action to the last image on the stack, binary commands apply to the last two images and so on. Commands are affected by options, which are listed separately.
-swapdim: Reorder the coordinate axes of an image
Syntax -swapdim <code>
This command reorders the image axes (columns, rows, slices) to achieve a desired transformation between voxel space and physical space. The image remains exactly the same in physical space, but the encoding of the voxels in memory and on disk is changed to obtain the desired transformation. The transformation is specified as a three-letter 'RAI' code, as in the '''-orient''' command.
c3d img.nii -swapdim ASL -info -o out.nii
Commands: Image Processing
The following commands invoke an action that is applied to images. Unary commands apply the action to the last image on the stack, binary commands apply to the last two images and so on. Commands are affected by options, which are listed separately.
7600 def run( 7601 self, 7602 execution: Execution, 7603 ) -> list[str]: 7604 """ 7605 Build command line arguments. This method is called by the main command. 7606 7607 Args: 7608 execution: The execution object. 7609 Returns: 7610 Command line arguments 7611 """ 7612 cargs = [] 7613 cargs.extend([ 7614 "-swapdim", 7615 self.swapdim 7616 ]) 7617 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7620@dataclasses.dataclass 7621class C3dTestImage: 7622 """ 7623 -test-image, -test-probe: Test condition 7624 7625 Syntax: `-test-image [tolerance]` and `-test-probe <vector> <value> 7626 [tolerance]` 7627 7628 These advanced commands (with more to come in the future) are primarily 7629 meant to allow testing of **c3d**. However, they can also be used for flow 7630 control in shell scripts (e.g., **bash** shell). The commands check a 7631 certain aspect of the **c3d** state and cause the program to exit with 7632 either return code 0 if the test succeeded or a non-zero return code if the 7633 test failed. 7634 7635 **-test-image** tests if the last two images on the stack are identical 7636 (both in terms of data and header). Returns 0 if the images are identical. 7637 The optional tolerance parameter has default value 1e-8. 7638 7639 c3d input1.img input2.img -test-image 7640 7641 **-test-probe** is similar to the **-probe** command. It tests if the value 7642 of the last image on the stack at the position given by **vector** is equal 7643 to the **test_value**. An optional tolerance value may be specified, the 7644 default is 1e-8. 7645 7646 c3d input1.img -test-probe 40x40x20vox 1.0 1e-6. 7647 """ 7648 test_image: str 7649 """-test-image, -test-probe: Test condition 7650 7651 Syntax: `-test-image [tolerance]` and `-test-probe <vector> <value> 7652 [tolerance]` 7653 7654 These advanced commands (with more to come in the future) are primarily 7655 meant to allow testing of **c3d**. However, they can also be used for flow 7656 control in shell scripts (e.g., **bash** shell). The commands check a 7657 certain aspect of the **c3d** state and cause the program to exit with 7658 either return code 0 if the test succeeded or a non-zero return code if the 7659 test failed. 7660 7661 **-test-image** tests if the last two images on the stack are identical 7662 (both in terms of data and header). Returns 0 if the images are identical. 7663 The optional tolerance parameter has default value 1e-8. 7664 7665 c3d input1.img input2.img -test-image 7666 7667 **-test-probe** is similar to the **-probe** command. It tests if the value 7668 of the last image on the stack at the position given by **vector** is equal 7669 to the **test_value**. An optional tolerance value may be specified, the 7670 default is 1e-8. 7671 7672 c3d input1.img -test-probe 40x40x20vox 1.0 1e-6""" 7673 7674 def run( 7675 self, 7676 execution: Execution, 7677 ) -> list[str]: 7678 """ 7679 Build command line arguments. This method is called by the main command. 7680 7681 Args: 7682 execution: The execution object. 7683 Returns: 7684 Command line arguments 7685 """ 7686 cargs = [] 7687 cargs.extend([ 7688 "-test-image", 7689 self.test_image 7690 ]) 7691 return cargs
-test-image, -test-probe: Test condition
Syntax: -test-image [tolerance] and -test-probe <vector> <value>
[tolerance]
These advanced commands (with more to come in the future) are primarily meant to allow testing of c3d. However, they can also be used for flow control in shell scripts (e.g., bash shell). The commands check a certain aspect of the c3d state and cause the program to exit with either return code 0 if the test succeeded or a non-zero return code if the test failed.
-test-image tests if the last two images on the stack are identical (both in terms of data and header). Returns 0 if the images are identical. The optional tolerance parameter has default value 1e-8.
c3d input1.img input2.img -test-image
-test-probe is similar to the -probe command. It tests if the value of the last image on the stack at the position given by vector is equal to the test_value. An optional tolerance value may be specified, the default is 1e-8.
c3d input1.img -test-probe 40x40x20vox 1.0 1e-6.
-test-image, -test-probe: Test condition
Syntax: -test-image [tolerance] and -test-probe <vector> <value>
[tolerance]
These advanced commands (with more to come in the future) are primarily meant to allow testing of c3d. However, they can also be used for flow control in shell scripts (e.g., bash shell). The commands check a certain aspect of the c3d state and cause the program to exit with either return code 0 if the test succeeded or a non-zero return code if the test failed.
-test-image tests if the last two images on the stack are identical (both in terms of data and header). Returns 0 if the images are identical. The optional tolerance parameter has default value 1e-8.
c3d input1.img input2.img -test-image
-test-probe is similar to the -probe command. It tests if the value of the last image on the stack at the position given by vector is equal to the test_value. An optional tolerance value may be specified, the default is 1e-8.
c3d input1.img -test-probe 40x40x20vox 1.0 1e-6
7674 def run( 7675 self, 7676 execution: Execution, 7677 ) -> list[str]: 7678 """ 7679 Build command line arguments. This method is called by the main command. 7680 7681 Args: 7682 execution: The execution object. 7683 Returns: 7684 Command line arguments 7685 """ 7686 cargs = [] 7687 cargs.extend([ 7688 "-test-image", 7689 self.test_image 7690 ]) 7691 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7694@dataclasses.dataclass 7695class C3dTestProbe: 7696 """ 7697 -test-image, -test-probe: Test condition 7698 7699 Syntax: `-test-image [tolerance]` and `-test-probe <vector> <value> 7700 [tolerance]` 7701 7702 These advanced commands (with more to come in the future) are primarily 7703 meant to allow testing of **c3d**. However, they can also be used for flow 7704 control in shell scripts (e.g., **bash** shell). The commands check a 7705 certain aspect of the **c3d** state and cause the program to exit with 7706 either return code 0 if the test succeeded or a non-zero return code if the 7707 test failed. 7708 7709 **-test-image** tests if the last two images on the stack are identical 7710 (both in terms of data and header). Returns 0 if the images are identical. 7711 The optional tolerance parameter has default value 1e-8. 7712 7713 c3d input1.img input2.img -test-image 7714 7715 **-test-probe** is similar to the **-probe** command. It tests if the value 7716 of the last image on the stack at the position given by **vector** is equal 7717 to the **test_value**. An optional tolerance value may be specified, the 7718 default is 1e-8. 7719 7720 c3d input1.img -test-probe 40x40x20vox 1.0 1e-6. 7721 """ 7722 test_probe: str 7723 """-test-image, -test-probe: Test condition 7724 7725 Syntax: `-test-image [tolerance]` and `-test-probe <vector> <value> 7726 [tolerance]` 7727 7728 These advanced commands (with more to come in the future) are primarily 7729 meant to allow testing of **c3d**. However, they can also be used for flow 7730 control in shell scripts (e.g., **bash** shell). The commands check a 7731 certain aspect of the **c3d** state and cause the program to exit with 7732 either return code 0 if the test succeeded or a non-zero return code if the 7733 test failed. 7734 7735 **-test-image** tests if the last two images on the stack are identical 7736 (both in terms of data and header). Returns 0 if the images are identical. 7737 The optional tolerance parameter has default value 1e-8. 7738 7739 c3d input1.img input2.img -test-image 7740 7741 **-test-probe** is similar to the **-probe** command. It tests if the value 7742 of the last image on the stack at the position given by **vector** is equal 7743 to the **test_value**. An optional tolerance value may be specified, the 7744 default is 1e-8. 7745 7746 c3d input1.img -test-probe 40x40x20vox 1.0 1e-6""" 7747 7748 def run( 7749 self, 7750 execution: Execution, 7751 ) -> list[str]: 7752 """ 7753 Build command line arguments. This method is called by the main command. 7754 7755 Args: 7756 execution: The execution object. 7757 Returns: 7758 Command line arguments 7759 """ 7760 cargs = [] 7761 cargs.extend([ 7762 "-test-probe", 7763 self.test_probe 7764 ]) 7765 return cargs
-test-image, -test-probe: Test condition
Syntax: -test-image [tolerance] and -test-probe <vector> <value>
[tolerance]
These advanced commands (with more to come in the future) are primarily meant to allow testing of c3d. However, they can also be used for flow control in shell scripts (e.g., bash shell). The commands check a certain aspect of the c3d state and cause the program to exit with either return code 0 if the test succeeded or a non-zero return code if the test failed.
-test-image tests if the last two images on the stack are identical (both in terms of data and header). Returns 0 if the images are identical. The optional tolerance parameter has default value 1e-8.
c3d input1.img input2.img -test-image
-test-probe is similar to the -probe command. It tests if the value of the last image on the stack at the position given by vector is equal to the test_value. An optional tolerance value may be specified, the default is 1e-8.
c3d input1.img -test-probe 40x40x20vox 1.0 1e-6.
-test-image, -test-probe: Test condition
Syntax: -test-image [tolerance] and -test-probe <vector> <value>
[tolerance]
These advanced commands (with more to come in the future) are primarily meant to allow testing of c3d. However, they can also be used for flow control in shell scripts (e.g., bash shell). The commands check a certain aspect of the c3d state and cause the program to exit with either return code 0 if the test succeeded or a non-zero return code if the test failed.
-test-image tests if the last two images on the stack are identical (both in terms of data and header). Returns 0 if the images are identical. The optional tolerance parameter has default value 1e-8.
c3d input1.img input2.img -test-image
-test-probe is similar to the -probe command. It tests if the value of the last image on the stack at the position given by vector is equal to the test_value. An optional tolerance value may be specified, the default is 1e-8.
c3d input1.img -test-probe 40x40x20vox 1.0 1e-6
7748 def run( 7749 self, 7750 execution: Execution, 7751 ) -> list[str]: 7752 """ 7753 Build command line arguments. This method is called by the main command. 7754 7755 Args: 7756 execution: The execution object. 7757 Returns: 7758 Command line arguments 7759 """ 7760 cargs = [] 7761 cargs.extend([ 7762 "-test-probe", 7763 self.test_probe 7764 ]) 7765 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7768@dataclasses.dataclass 7769class C3dThreshold: 7770 """ 7771 -thresh, -threshold: Binary thresholding 7772 7773 Syntax: `-thresh <u1 u2 vIn vOut> ` 7774 7775 Thresholds the image, setting voxels whose intensity is in the range [u1,u2] 7776 to vIn and all other voxels to vOut. Values *u1* and *u2* are intensity 7777 specifications (see below). This means that you can supply values **inf** 7778 and **-inf** for u1 and u2 to construct a one-sided threshold. You can also 7779 specify *u1* and *u2* as percentiles. 7780 c3d in.img -threshold -inf 128 1 0 -o out.img 7781 c3d in.img -threshold 64 128 1 0 -o out.img 7782 c3d in.img -threshold 20% 40% 1 0 -o out.img. 7783 """ 7784 threshold: str 7785 """-thresh, -threshold: Binary thresholding 7786 7787 Syntax: `-thresh <u1 u2 vIn vOut> ` 7788 7789 Thresholds the image, setting voxels whose intensity is in the range [u1,u2] 7790 to vIn and all other voxels to vOut. Values *u1* and *u2* are intensity 7791 specifications (see below). This means that you can supply values **inf** 7792 and **-inf** for u1 and u2 to construct a one-sided threshold. You can also 7793 specify *u1* and *u2* as percentiles. 7794 c3d in.img -threshold -inf 128 1 0 -o out.img 7795 c3d in.img -threshold 64 128 1 0 -o out.img 7796 c3d in.img -threshold 20% 40% 1 0 -o out.img""" 7797 7798 def run( 7799 self, 7800 execution: Execution, 7801 ) -> list[str]: 7802 """ 7803 Build command line arguments. This method is called by the main command. 7804 7805 Args: 7806 execution: The execution object. 7807 Returns: 7808 Command line arguments 7809 """ 7810 cargs = [] 7811 cargs.extend([ 7812 "-threshold", 7813 self.threshold 7814 ]) 7815 return cargs
-thresh, -threshold: Binary thresholding
Syntax: -thresh <u1 u2 vIn vOut>
Thresholds the image, setting voxels whose intensity is in the range [u1,u2] to vIn and all other voxels to vOut. Values u1 and u2 are intensity specifications (see below). This means that you can supply values inf and -inf for u1 and u2 to construct a one-sided threshold. You can also specify u1 and u2 as percentiles. c3d in.img -threshold -inf 128 1 0 -o out.img c3d in.img -threshold 64 128 1 0 -o out.img c3d in.img -threshold 20% 40% 1 0 -o out.img.
-thresh, -threshold: Binary thresholding
Syntax: -thresh <u1 u2 vIn vOut>
Thresholds the image, setting voxels whose intensity is in the range [u1,u2] to vIn and all other voxels to vOut. Values u1 and u2 are intensity specifications (see below). This means that you can supply values inf and -inf for u1 and u2 to construct a one-sided threshold. You can also specify u1 and u2 as percentiles. c3d in.img -threshold -inf 128 1 0 -o out.img c3d in.img -threshold 64 128 1 0 -o out.img c3d in.img -threshold 20% 40% 1 0 -o out.img
7798 def run( 7799 self, 7800 execution: Execution, 7801 ) -> list[str]: 7802 """ 7803 Build command line arguments. This method is called by the main command. 7804 7805 Args: 7806 execution: The execution object. 7807 Returns: 7808 Command line arguments 7809 """ 7810 cargs = [] 7811 cargs.extend([ 7812 "-threshold", 7813 self.threshold 7814 ]) 7815 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7818@dataclasses.dataclass 7819class C3dTile: 7820 """ 7821 -tile: Tile and stack multiple images into one 7822 7823 Syntax: `-tile <tile_spec>` 7824 7825 Tiles multiple images into a single image -- including stacking slices into 7826 a 3D volume. The command takes all images on the stack and produces a single 7827 tiled image. The **tile_spec** parameter can either specify a coordinate 7828 axis (x, y, or z) along which to tile the images, or a layout vector (e.g., 7829 **4x4**) which specifies the tiling along each coordinate. Passing 0 for the 7830 last value in the layout vector determines the value based on the number of 7831 images currently loaded. For example, to create a 3D volume from a set of 7832 slices, we use 7833 7834 c3d slices*.png -tile z -o volume.nii.gz 7835 7836 And to arrange the same 2D slices into a 2D montage of 4 images per row, we 7837 would use the **c2d** command as follows: 7838 7839 c2d slices*.png -tile 4x0 -type uchar -o montage.png. 7840 """ 7841 tile: str 7842 """-tile: Tile and stack multiple images into one 7843 7844 Syntax: `-tile <tile_spec>` 7845 7846 Tiles multiple images into a single image -- including stacking slices into 7847 a 3D volume. The command takes all images on the stack and produces a single 7848 tiled image. The **tile_spec** parameter can either specify a coordinate 7849 axis (x, y, or z) along which to tile the images, or a layout vector (e.g., 7850 **4x4**) which specifies the tiling along each coordinate. Passing 0 for the 7851 last value in the layout vector determines the value based on the number of 7852 images currently loaded. For example, to create a 3D volume from a set of 7853 slices, we use 7854 7855 c3d slices*.png -tile z -o volume.nii.gz 7856 7857 And to arrange the same 2D slices into a 2D montage of 4 images per row, we 7858 would use the **c2d** command as follows: 7859 7860 c2d slices*.png -tile 4x0 -type uchar -o montage.png""" 7861 7862 def run( 7863 self, 7864 execution: Execution, 7865 ) -> list[str]: 7866 """ 7867 Build command line arguments. This method is called by the main command. 7868 7869 Args: 7870 execution: The execution object. 7871 Returns: 7872 Command line arguments 7873 """ 7874 cargs = [] 7875 cargs.extend([ 7876 "-tile", 7877 self.tile 7878 ]) 7879 return cargs
-tile: Tile and stack multiple images into one
Syntax: -tile <tile_spec>
Tiles multiple images into a single image -- including stacking slices into a 3D volume. The command takes all images on the stack and produces a single tiled image. The tile_spec parameter can either specify a coordinate axis (x, y, or z) along which to tile the images, or a layout vector (e.g., 4x4) which specifies the tiling along each coordinate. Passing 0 for the last value in the layout vector determines the value based on the number of images currently loaded. For example, to create a 3D volume from a set of slices, we use
c3d slices*.png -tile z -o volume.nii.gz
And to arrange the same 2D slices into a 2D montage of 4 images per row, we would use the c2d command as follows:
c2d slices*.png -tile 4x0 -type uchar -o montage.png.
-tile: Tile and stack multiple images into one
Syntax: -tile <tile_spec>
Tiles multiple images into a single image -- including stacking slices into a 3D volume. The command takes all images on the stack and produces a single tiled image. The tile_spec parameter can either specify a coordinate axis (x, y, or z) along which to tile the images, or a layout vector (e.g., 4x4) which specifies the tiling along each coordinate. Passing 0 for the last value in the layout vector determines the value based on the number of images currently loaded. For example, to create a 3D volume from a set of slices, we use
c3d slices*.png -tile z -o volume.nii.gz
And to arrange the same 2D slices into a 2D montage of 4 images per row, we would use the c2d command as follows:
c2d slices*.png -tile 4x0 -type uchar -o montage.png
7862 def run( 7863 self, 7864 execution: Execution, 7865 ) -> list[str]: 7866 """ 7867 Build command line arguments. This method is called by the main command. 7868 7869 Args: 7870 execution: The execution object. 7871 Returns: 7872 Command line arguments 7873 """ 7874 cargs = [] 7875 cargs.extend([ 7876 "-tile", 7877 self.tile 7878 ]) 7879 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7882@dataclasses.dataclass 7883class C3dTrim: 7884 """ 7885 -trim: Trim background region of image 7886 7887 Syntax: `-trim <margin_vector>` 7888 7889 Use this command to trim background in an image. When most of the image is 7890 filled by background, this command will find the smallest rectangular region 7891 that contains all of the non-background voxels in the image. I will then 7892 expand this region by the margin of the size specified, and return the 7893 resulting region as the new image. For example, this command will trim an 7894 image, leaving a 5-voxel margin of background values on all sides 7895 7896 c3d in.img -trim 5vox -o out.img. 7897 """ 7898 trim: str 7899 """-trim: Trim background region of image 7900 7901 Syntax: `-trim <margin_vector>` 7902 7903 Use this command to trim background in an image. When most of the image is 7904 filled by background, this command will find the smallest rectangular region 7905 that contains all of the non-background voxels in the image. I will then 7906 expand this region by the margin of the size specified, and return the 7907 resulting region as the new image. For example, this command will trim an 7908 image, leaving a 5-voxel margin of background values on all sides 7909 7910 c3d in.img -trim 5vox -o out.img""" 7911 7912 def run( 7913 self, 7914 execution: Execution, 7915 ) -> list[str]: 7916 """ 7917 Build command line arguments. This method is called by the main command. 7918 7919 Args: 7920 execution: The execution object. 7921 Returns: 7922 Command line arguments 7923 """ 7924 cargs = [] 7925 cargs.extend([ 7926 "-trim", 7927 self.trim 7928 ]) 7929 return cargs
-trim: Trim background region of image
Syntax: -trim <margin_vector>
Use this command to trim background in an image. When most of the image is filled by background, this command will find the smallest rectangular region that contains all of the non-background voxels in the image. I will then expand this region by the margin of the size specified, and return the resulting region as the new image. For example, this command will trim an image, leaving a 5-voxel margin of background values on all sides
c3d in.img -trim 5vox -o out.img.
-trim: Trim background region of image
Syntax: -trim <margin_vector>
Use this command to trim background in an image. When most of the image is filled by background, this command will find the smallest rectangular region that contains all of the non-background voxels in the image. I will then expand this region by the margin of the size specified, and return the resulting region as the new image. For example, this command will trim an image, leaving a 5-voxel margin of background values on all sides
c3d in.img -trim 5vox -o out.img
7912 def run( 7913 self, 7914 execution: Execution, 7915 ) -> list[str]: 7916 """ 7917 Build command line arguments. This method is called by the main command. 7918 7919 Args: 7920 execution: The execution object. 7921 Returns: 7922 Command line arguments 7923 """ 7924 cargs = [] 7925 cargs.extend([ 7926 "-trim", 7927 self.trim 7928 ]) 7929 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7932@dataclasses.dataclass 7933class C3dTrimToSize: 7934 """ 7935 -trim-to-size: Trim image to given size 7936 7937 Syntax: `-trim-to-size <size_vector>` 7938 7939 Like **-trim**, this command trims the background in an image. However, 7940 instead of **-trim**, you specify the target size of the output region. The 7941 actual region may be smaller if the specified region falls outside the 7942 boundaries of the input image. For example, if you want a 64x64x128 image 7943 containing all the foreground pixels in your image, call 7944 7945 c3d in.img -trim-to-size 64x64x128vox -o out.img. 7946 """ 7947 trim_to_size: str 7948 """-trim-to-size: Trim image to given size 7949 7950 Syntax: `-trim-to-size <size_vector>` 7951 7952 Like **-trim**, this command trims the background in an image. However, 7953 instead of **-trim**, you specify the target size of the output region. The 7954 actual region may be smaller if the specified region falls outside the 7955 boundaries of the input image. For example, if you want a 64x64x128 image 7956 containing all the foreground pixels in your image, call 7957 7958 c3d in.img -trim-to-size 64x64x128vox -o out.img""" 7959 7960 def run( 7961 self, 7962 execution: Execution, 7963 ) -> list[str]: 7964 """ 7965 Build command line arguments. This method is called by the main command. 7966 7967 Args: 7968 execution: The execution object. 7969 Returns: 7970 Command line arguments 7971 """ 7972 cargs = [] 7973 cargs.extend([ 7974 "-trim-to-size", 7975 self.trim_to_size 7976 ]) 7977 return cargs
-trim-to-size: Trim image to given size
Syntax: -trim-to-size <size_vector>
Like -trim, this command trims the background in an image. However, instead of -trim, you specify the target size of the output region. The actual region may be smaller if the specified region falls outside the boundaries of the input image. For example, if you want a 64x64x128 image containing all the foreground pixels in your image, call
c3d in.img -trim-to-size 64x64x128vox -o out.img.
-trim-to-size: Trim image to given size
Syntax: -trim-to-size <size_vector>
Like -trim, this command trims the background in an image. However, instead of -trim, you specify the target size of the output region. The actual region may be smaller if the specified region falls outside the boundaries of the input image. For example, if you want a 64x64x128 image containing all the foreground pixels in your image, call
c3d in.img -trim-to-size 64x64x128vox -o out.img
7960 def run( 7961 self, 7962 execution: Execution, 7963 ) -> list[str]: 7964 """ 7965 Build command line arguments. This method is called by the main command. 7966 7967 Args: 7968 execution: The execution object. 7969 Returns: 7970 Command line arguments 7971 """ 7972 cargs = [] 7973 cargs.extend([ 7974 "-trim-to-size", 7975 self.trim_to_size 7976 ]) 7977 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
7980@dataclasses.dataclass 7981class C3dType: 7982 """ 7983 -type: Specify pixel type for image output 7984 7985 Syntax: `-type < char | uchar | short | ushort | int | uint | float | double 7986 > ` 7987 7988 Specifies the pixel type for the output image. By default, images are 7989 written in floating point (**float**) format. The type does not affect how 7990 images are processed, only how they are saved. 7991 7992 c3d image1.img -type short image2.img 7993 7994 Some images require data in certain types. For example, to save PNG images, 7995 uchar or ushort type must be specified. 7996 """ 7997 type_: str 7998 """-type: Specify pixel type for image output 7999 8000 Syntax: `-type < char | uchar | short | ushort | int | uint | float | double 8001 > ` 8002 8003 Specifies the pixel type for the output image. By default, images are 8004 written in floating point (**float**) format. The type does not affect how 8005 images are processed, only how they are saved. 8006 8007 c3d image1.img -type short image2.img 8008 8009 Some images require data in certain types. For example, to save PNG images, 8010 uchar or ushort type must be specified.""" 8011 8012 def run( 8013 self, 8014 execution: Execution, 8015 ) -> list[str]: 8016 """ 8017 Build command line arguments. This method is called by the main command. 8018 8019 Args: 8020 execution: The execution object. 8021 Returns: 8022 Command line arguments 8023 """ 8024 cargs = [] 8025 cargs.extend([ 8026 "-type", 8027 self.type_ 8028 ]) 8029 return cargs
-type: Specify pixel type for image output
Syntax: `-type < char | uchar | short | ushort | int | uint | float | double
`
Specifies the pixel type for the output image. By default, images are written in floating point (float) format. The type does not affect how images are processed, only how they are saved.
c3d image1.img -type short image2.img
Some images require data in certain types. For example, to save PNG images, uchar or ushort type must be specified.
-type: Specify pixel type for image output
Syntax: `-type < char | uchar | short | ushort | int | uint | float | double
`
Specifies the pixel type for the output image. By default, images are written in floating point (float) format. The type does not affect how images are processed, only how they are saved.
c3d image1.img -type short image2.img
Some images require data in certain types. For example, to save PNG images, uchar or ushort type must be specified.
8012 def run( 8013 self, 8014 execution: Execution, 8015 ) -> list[str]: 8016 """ 8017 Build command line arguments. This method is called by the main command. 8018 8019 Args: 8020 execution: The execution object. 8021 Returns: 8022 Command line arguments 8023 """ 8024 cargs = [] 8025 cargs.extend([ 8026 "-type", 8027 self.type_ 8028 ]) 8029 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8032@dataclasses.dataclass 8033class C3dVerbose: 8034 """ 8035 -verbose: Enable verbose output of commands 8036 8037 Syntax: `-verbose` 8038 8039 Commands entered after the **-verbose** command will print debugging 8040 information. This can be turned off with **-noverbose**. 8041 8042 ### Parameter Specifications. 8043 """ 8044 verbose: str 8045 """-verbose: Enable verbose output of commands 8046 8047 Syntax: `-verbose` 8048 8049 Commands entered after the **-verbose** command will print debugging 8050 information. This can be turned off with **-noverbose**. 8051 8052 ### Parameter Specifications""" 8053 8054 def run( 8055 self, 8056 execution: Execution, 8057 ) -> list[str]: 8058 """ 8059 Build command line arguments. This method is called by the main command. 8060 8061 Args: 8062 execution: The execution object. 8063 Returns: 8064 Command line arguments 8065 """ 8066 cargs = [] 8067 cargs.extend([ 8068 "-verbose", 8069 self.verbose 8070 ]) 8071 return cargs
-verbose: Enable verbose output of commands
Syntax: -verbose
Commands entered after the -verbose command will print debugging information. This can be turned off with -noverbose.
Parameter Specifications.
-verbose: Enable verbose output of commands
Syntax: -verbose
Commands entered after the -verbose command will print debugging information. This can be turned off with -noverbose.
Parameter Specifications
8054 def run( 8055 self, 8056 execution: Execution, 8057 ) -> list[str]: 8058 """ 8059 Build command line arguments. This method is called by the main command. 8060 8061 Args: 8062 execution: The execution object. 8063 Returns: 8064 Command line arguments 8065 """ 8066 cargs = [] 8067 cargs.extend([ 8068 "-verbose", 8069 self.verbose 8070 ]) 8071 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8102@dataclasses.dataclass 8103class C3dVersion: 8104 """ 8105 No description found. 8106 """ 8107 version: str 8108 """No description found.""" 8109 8110 def run( 8111 self, 8112 execution: Execution, 8113 ) -> list[str]: 8114 """ 8115 Build command line arguments. This method is called by the main command. 8116 8117 Args: 8118 execution: The execution object. 8119 Returns: 8120 Command line arguments 8121 """ 8122 cargs = [] 8123 cargs.extend([ 8124 "-version", 8125 self.version 8126 ]) 8127 return cargs
No description found.
8110 def run( 8111 self, 8112 execution: Execution, 8113 ) -> list[str]: 8114 """ 8115 Build command line arguments. This method is called by the main command. 8116 8117 Args: 8118 execution: The execution object. 8119 Returns: 8120 Command line arguments 8121 """ 8122 cargs = [] 8123 cargs.extend([ 8124 "-version", 8125 self.version 8126 ]) 8127 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8130@dataclasses.dataclass 8131class C3dVote: 8132 """ 8133 -vote: Vote among images on the stack 8134 8135 Syntax: `-vote ` 8136 8137 This command takes all images on the stack as arguments and at each voxel 8138 *(i,j,k)* returns the index of the image for which the image value at 8139 *(i,j,k)* is the greatest. This is most useful when combining probability 8140 maps into a single label image. If images prob1.img, prob2.img, etc. give 8141 the probability of label 1, 2, etc. over the image domain, the **-vote** 8142 command will return the most probable label at each voxel. 8143 8144 c3d prob1.img prob2.img prob3.img -vote -type uchar -o label.img 8145 8146 The value assigned to each image is based on its position from the bottom of 8147 the stack, with zero indicating bottom-most image. In the example above, the 8148 output image has values 0 for voxels where prob1.img is highest, 1 for 8149 prob2.img and 2 for prob3.img. Also see the related commands **-split** and 8150 **-merge**. 8151 """ 8152 vote: str 8153 """-vote: Vote among images on the stack 8154 8155 Syntax: `-vote ` 8156 8157 This command takes all images on the stack as arguments and at each voxel 8158 *(i,j,k)* returns the index of the image for which the image value at 8159 *(i,j,k)* is the greatest. This is most useful when combining probability 8160 maps into a single label image. If images prob1.img, prob2.img, etc. give 8161 the probability of label 1, 2, etc. over the image domain, the **-vote** 8162 command will return the most probable label at each voxel. 8163 8164 c3d prob1.img prob2.img prob3.img -vote -type uchar -o label.img 8165 8166 The value assigned to each image is based on its position from the bottom of 8167 the stack, with zero indicating bottom-most image. In the example above, the 8168 output image has values 0 for voxels where prob1.img is highest, 1 for 8169 prob2.img and 2 for prob3.img. Also see the related commands **-split** and 8170 **-merge**.""" 8171 8172 def run( 8173 self, 8174 execution: Execution, 8175 ) -> list[str]: 8176 """ 8177 Build command line arguments. This method is called by the main command. 8178 8179 Args: 8180 execution: The execution object. 8181 Returns: 8182 Command line arguments 8183 """ 8184 cargs = [] 8185 cargs.extend([ 8186 "-vote", 8187 self.vote 8188 ]) 8189 return cargs
-vote: Vote among images on the stack
Syntax: -vote
This command takes all images on the stack as arguments and at each voxel (i,j,k) returns the index of the image for which the image value at (i,j,k) is the greatest. This is most useful when combining probability maps into a single label image. If images prob1.img, prob2.img, etc. give the probability of label 1, 2, etc. over the image domain, the -vote command will return the most probable label at each voxel.
c3d prob1.img prob2.img prob3.img -vote -type uchar -o label.img
The value assigned to each image is based on its position from the bottom of the stack, with zero indicating bottom-most image. In the example above, the output image has values 0 for voxels where prob1.img is highest, 1 for prob2.img and 2 for prob3.img. Also see the related commands -split and -merge.
-vote: Vote among images on the stack
Syntax: -vote
This command takes all images on the stack as arguments and at each voxel (i,j,k) returns the index of the image for which the image value at (i,j,k) is the greatest. This is most useful when combining probability maps into a single label image. If images prob1.img, prob2.img, etc. give the probability of label 1, 2, etc. over the image domain, the -vote command will return the most probable label at each voxel.
c3d prob1.img prob2.img prob3.img -vote -type uchar -o label.img
The value assigned to each image is based on its position from the bottom of the stack, with zero indicating bottom-most image. In the example above, the output image has values 0 for voxels where prob1.img is highest, 1 for prob2.img and 2 for prob3.img. Also see the related commands -split and -merge.
8172 def run( 8173 self, 8174 execution: Execution, 8175 ) -> list[str]: 8176 """ 8177 Build command line arguments. This method is called by the main command. 8178 8179 Args: 8180 execution: The execution object. 8181 Returns: 8182 Command line arguments 8183 """ 8184 cargs = [] 8185 cargs.extend([ 8186 "-vote", 8187 self.vote 8188 ]) 8189 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8356@dataclasses.dataclass 8357class C3dVoteLabel: 8358 """ 8359 No description found. 8360 """ 8361 vote_label: str 8362 """No description found.""" 8363 8364 def run( 8365 self, 8366 execution: Execution, 8367 ) -> list[str]: 8368 """ 8369 Build command line arguments. This method is called by the main command. 8370 8371 Args: 8372 execution: The execution object. 8373 Returns: 8374 Command line arguments 8375 """ 8376 cargs = [] 8377 cargs.extend([ 8378 "-vote-label", 8379 self.vote_label 8380 ]) 8381 return cargs
No description found.
8364 def run( 8365 self, 8366 execution: Execution, 8367 ) -> list[str]: 8368 """ 8369 Build command line arguments. This method is called by the main command. 8370 8371 Args: 8372 execution: The execution object. 8373 Returns: 8374 Command line arguments 8375 """ 8376 cargs = [] 8377 cargs.extend([ 8378 "-vote-label", 8379 self.vote_label 8380 ]) 8381 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8192@dataclasses.dataclass 8193class C3dVoteMrf: 8194 """ 8195 -vote-mrf: Vote with Markov Random Field regularlization 8196 8197 Syntax: `-vote-mrf <mode> <lambda>` 8198 8199 This command is similar to **-vote** but it performs regularlization using 8200 the Markov Random Field (MRF). This form of regularization penalizes the 8201 total surface area of the segments in the output. It results in more 8202 contiguous segments. 8203 8204 The command takes all the images on the stack and assumes that they are 8205 likelihood images corresponding to labels 1, 2, ... N. This means that voxel 8206 **x** in image **k** holds the probability that voxel **x** has label **k**. 8207 Likelihood images must be between 0 and 1. Any values outside of the range 8208 are interpreted as the voxel being excluded from the voting. These voxels 8209 will be assigned label 0 in the output. 8210 8211 The problem is encoded in the form of energy minimization, consisting of a 8212 data term and a regularization term. The data term encodes the cost 8213 (penalty) associated with assigning the voxel **x** the label **k**. The 8214 parameter **mode** describes how likelihood images are mapped to the cost. 8215 8216 * `VOTES_AGAINST` or `VA`. This mode is useful when the command is being 8217 used to combine several multi-label segmentations into a single one. Each 8218 likelihood image is assumed to be the proportion of segmentations that 8219 assign label *k* to voxel *x*. The data term equals to the error associated 8220 to assining the voxel *k* label *x*. This error is calculated as the sum of 8221 the likelihoods for all labels at *x* minus the likelihood for *k* at *x*. 8222 Note that the likelihoods do not have to add up to one, which may be 8223 interpreted as missing data for some voxels. 8224 8225 * `LOG_LIKELIHOOD` or `LL`. The cost for label *k* at voxel *x* is the 8226 logarithm of the k-th likelihood image at *x*. This will assign infinite 8227 cost when the likelihood is zero. 8228 8229 The regularlization term is encoded as **lambda** times the total number of 8230 neighboring voxels inside the mask (non-excluded region of the image) that 8231 have different labels. 8232 8233 The optmization problem is solved using the Alpha-Expansion graph cut 8234 algorithm. Users of this functionality should cite the following papers. 8235 8236 1. Yuri Boykov, Olga Veksler, Ramin Zabih, *Efficient Approximate Energy 8237 Minimization via Graph Cuts*, IEEE transactions on PAMI, vol. 20, no. 12, p. 8238 1222-1239, 2001. 8239 8240 2. Vladimir Kolmogorov and Ramin Zabih, *What Energy Functions can be 8241 Minimized via Graph Cuts?*, IEEE transactions on PAMI, vol. 26, no. 2, p. 8242 147-159, 2004. 8243 8244 3. Yuri Boykov and Vladimir Kolmogorov, *An Experimental Comparison of 8245 Min-Cut/Max-Flow Algorithms for Energy Minimization in Vision*, IEEE 8246 transactions on PAMI, vol. 26, no. 9, p. 1124-1137, 2004. 8247 8248 As noted in the open source implementation of the graph cuts algorithms 8249 distributed under the General Public License, "This software can be used 8250 only for research purposes, you should cite the aforementioned paper in any 8251 resulting publication. If you wish to use this software (or the algorithms 8252 described in the aforementioned paper) for commercial purposes, you should 8253 be aware that there is a US patent: R. Zabih, Y. Boykov, O. Veksler, *System 8254 and method for fast approximate energy minimization via graph cuts*, United 8255 Stated Patent 6,744,923, June 1, 2004. 8256 8257 The example below illustrates applying **-vote-mrf** with a user-specified 8258 mask. Voxels outside of the mask are first remapped to NaN (not a number) 8259 and thus excluded from the MRF optimization and given 0 label. 8260 8261 c3d lhood01.nii lhood02.nii lhood03.nii mask.nii -popas M \ 8262 -foreach -push M -replace 0 NaN -times -endfor \ 8263 -vote-mrf VA 0.2 -o result.nii. 8264 """ 8265 vote_mrf: str 8266 """-vote-mrf: Vote with Markov Random Field regularlization 8267 8268 Syntax: `-vote-mrf <mode> <lambda>` 8269 8270 This command is similar to **-vote** but it performs regularlization using 8271 the Markov Random Field (MRF). This form of regularization penalizes the 8272 total surface area of the segments in the output. It results in more 8273 contiguous segments. 8274 8275 The command takes all the images on the stack and assumes that they are 8276 likelihood images corresponding to labels 1, 2, ... N. This means that voxel 8277 **x** in image **k** holds the probability that voxel **x** has label **k**. 8278 Likelihood images must be between 0 and 1. Any values outside of the range 8279 are interpreted as the voxel being excluded from the voting. These voxels 8280 will be assigned label 0 in the output. 8281 8282 The problem is encoded in the form of energy minimization, consisting of a 8283 data term and a regularization term. The data term encodes the cost 8284 (penalty) associated with assigning the voxel **x** the label **k**. The 8285 parameter **mode** describes how likelihood images are mapped to the cost. 8286 8287 * `VOTES_AGAINST` or `VA`. This mode is useful when the command is being 8288 used to combine several multi-label segmentations into a single one. Each 8289 likelihood image is assumed to be the proportion of segmentations that 8290 assign label *k* to voxel *x*. The data term equals to the error associated 8291 to assining the voxel *k* label *x*. This error is calculated as the sum of 8292 the likelihoods for all labels at *x* minus the likelihood for *k* at *x*. 8293 Note that the likelihoods do not have to add up to one, which may be 8294 interpreted as missing data for some voxels. 8295 8296 * `LOG_LIKELIHOOD` or `LL`. The cost for label *k* at voxel *x* is the 8297 logarithm of the k-th likelihood image at *x*. This will assign infinite 8298 cost when the likelihood is zero. 8299 8300 The regularlization term is encoded as **lambda** times the total number of 8301 neighboring voxels inside the mask (non-excluded region of the image) that 8302 have different labels. 8303 8304 The optmization problem is solved using the Alpha-Expansion graph cut 8305 algorithm. Users of this functionality should cite the following papers. 8306 8307 1. Yuri Boykov, Olga Veksler, Ramin Zabih, *Efficient Approximate Energy 8308 Minimization via Graph Cuts*, IEEE transactions on PAMI, vol. 20, no. 12, p. 8309 1222-1239, 2001. 8310 8311 2. Vladimir Kolmogorov and Ramin Zabih, *What Energy Functions can be 8312 Minimized via Graph Cuts?*, IEEE transactions on PAMI, vol. 26, no. 2, p. 8313 147-159, 2004. 8314 8315 3. Yuri Boykov and Vladimir Kolmogorov, *An Experimental Comparison of 8316 Min-Cut/Max-Flow Algorithms for Energy Minimization in Vision*, IEEE 8317 transactions on PAMI, vol. 26, no. 9, p. 1124-1137, 2004. 8318 8319 As noted in the open source implementation of the graph cuts algorithms 8320 distributed under the General Public License, "This software can be used 8321 only for research purposes, you should cite the aforementioned paper in any 8322 resulting publication. If you wish to use this software (or the algorithms 8323 described in the aforementioned paper) for commercial purposes, you should 8324 be aware that there is a US patent: R. Zabih, Y. Boykov, O. Veksler, *System 8325 and method for fast approximate energy minimization via graph cuts*, United 8326 Stated Patent 6,744,923, June 1, 2004. 8327 8328 The example below illustrates applying **-vote-mrf** with a user-specified 8329 mask. Voxels outside of the mask are first remapped to NaN (not a number) 8330 and thus excluded from the MRF optimization and given 0 label. 8331 8332 c3d lhood01.nii lhood02.nii lhood03.nii mask.nii -popas M \ 8333 -foreach -push M -replace 0 NaN -times -endfor \ 8334 -vote-mrf VA 0.2 -o result.nii""" 8335 8336 def run( 8337 self, 8338 execution: Execution, 8339 ) -> list[str]: 8340 """ 8341 Build command line arguments. This method is called by the main command. 8342 8343 Args: 8344 execution: The execution object. 8345 Returns: 8346 Command line arguments 8347 """ 8348 cargs = [] 8349 cargs.extend([ 8350 "-vote-mrf", 8351 self.vote_mrf 8352 ]) 8353 return cargs
-vote-mrf: Vote with Markov Random Field regularlization
Syntax: -vote-mrf <mode> <lambda>
This command is similar to -vote but it performs regularlization using the Markov Random Field (MRF). This form of regularization penalizes the total surface area of the segments in the output. It results in more contiguous segments.
The command takes all the images on the stack and assumes that they are likelihood images corresponding to labels 1, 2, ... N. This means that voxel x in image k holds the probability that voxel x has label k. Likelihood images must be between 0 and 1. Any values outside of the range are interpreted as the voxel being excluded from the voting. These voxels will be assigned label 0 in the output.
The problem is encoded in the form of energy minimization, consisting of a data term and a regularization term. The data term encodes the cost (penalty) associated with assigning the voxel x the label k. The parameter mode describes how likelihood images are mapped to the cost.
VOTES_AGAINSTorVA. This mode is useful when the command is being used to combine several multi-label segmentations into a single one. Each likelihood image is assumed to be the proportion of segmentations that assign label k to voxel x. The data term equals to the error associated to assining the voxel k label x. This error is calculated as the sum of the likelihoods for all labels at x minus the likelihood for k at x. Note that the likelihoods do not have to add up to one, which may be interpreted as missing data for some voxels.LOG_LIKELIHOODorLL. The cost for label k at voxel x is the logarithm of the k-th likelihood image at x. This will assign infinite cost when the likelihood is zero.
The regularlization term is encoded as lambda times the total number of neighboring voxels inside the mask (non-excluded region of the image) that have different labels.
The optmization problem is solved using the Alpha-Expansion graph cut algorithm. Users of this functionality should cite the following papers.
Yuri Boykov, Olga Veksler, Ramin Zabih, Efficient Approximate Energy Minimization via Graph Cuts, IEEE transactions on PAMI, vol. 20, no. 12, p. 1222-1239, 2001.
Vladimir Kolmogorov and Ramin Zabih, What Energy Functions can be Minimized via Graph Cuts?, IEEE transactions on PAMI, vol. 26, no. 2, p. 147-159, 2004.
Yuri Boykov and Vladimir Kolmogorov, An Experimental Comparison of Min-Cut/Max-Flow Algorithms for Energy Minimization in Vision, IEEE transactions on PAMI, vol. 26, no. 9, p. 1124-1137, 2004.
As noted in the open source implementation of the graph cuts algorithms distributed under the General Public License, "This software can be used only for research purposes, you should cite the aforementioned paper in any resulting publication. If you wish to use this software (or the algorithms described in the aforementioned paper) for commercial purposes, you should be aware that there is a US patent: R. Zabih, Y. Boykov, O. Veksler, System and method for fast approximate energy minimization via graph cuts, United Stated Patent 6,744,923, June 1, 2004.
The example below illustrates applying -vote-mrf with a user-specified mask. Voxels outside of the mask are first remapped to NaN (not a number) and thus excluded from the MRF optimization and given 0 label.
c3d lhood01.nii lhood02.nii lhood03.nii mask.nii -popas M -foreach -push M -replace 0 NaN -times -endfor -vote-mrf VA 0.2 -o result.nii.
-vote-mrf: Vote with Markov Random Field regularlization
Syntax: -vote-mrf <mode> <lambda>
This command is similar to -vote but it performs regularlization using the Markov Random Field (MRF). This form of regularization penalizes the total surface area of the segments in the output. It results in more contiguous segments.
The command takes all the images on the stack and assumes that they are likelihood images corresponding to labels 1, 2, ... N. This means that voxel x in image k holds the probability that voxel x has label k. Likelihood images must be between 0 and 1. Any values outside of the range are interpreted as the voxel being excluded from the voting. These voxels will be assigned label 0 in the output.
The problem is encoded in the form of energy minimization, consisting of a data term and a regularization term. The data term encodes the cost (penalty) associated with assigning the voxel x the label k. The parameter mode describes how likelihood images are mapped to the cost.
VOTES_AGAINSTorVA. This mode is useful when the command is being used to combine several multi-label segmentations into a single one. Each likelihood image is assumed to be the proportion of segmentations that assign label k to voxel x. The data term equals to the error associated to assining the voxel k label x. This error is calculated as the sum of the likelihoods for all labels at x minus the likelihood for k at x. Note that the likelihoods do not have to add up to one, which may be interpreted as missing data for some voxels.LOG_LIKELIHOODorLL. The cost for label k at voxel x is the logarithm of the k-th likelihood image at x. This will assign infinite cost when the likelihood is zero.
The regularlization term is encoded as lambda times the total number of neighboring voxels inside the mask (non-excluded region of the image) that have different labels.
The optmization problem is solved using the Alpha-Expansion graph cut algorithm. Users of this functionality should cite the following papers.
Yuri Boykov, Olga Veksler, Ramin Zabih, Efficient Approximate Energy Minimization via Graph Cuts, IEEE transactions on PAMI, vol. 20, no. 12, p. 1222-1239, 2001.
Vladimir Kolmogorov and Ramin Zabih, What Energy Functions can be Minimized via Graph Cuts?, IEEE transactions on PAMI, vol. 26, no. 2, p. 147-159, 2004.
Yuri Boykov and Vladimir Kolmogorov, An Experimental Comparison of Min-Cut/Max-Flow Algorithms for Energy Minimization in Vision, IEEE transactions on PAMI, vol. 26, no. 9, p. 1124-1137, 2004.
As noted in the open source implementation of the graph cuts algorithms distributed under the General Public License, "This software can be used only for research purposes, you should cite the aforementioned paper in any resulting publication. If you wish to use this software (or the algorithms described in the aforementioned paper) for commercial purposes, you should be aware that there is a US patent: R. Zabih, Y. Boykov, O. Veksler, System and method for fast approximate energy minimization via graph cuts, United Stated Patent 6,744,923, June 1, 2004.
The example below illustrates applying -vote-mrf with a user-specified mask. Voxels outside of the mask are first remapped to NaN (not a number) and thus excluded from the MRF optimization and given 0 label.
c3d lhood01.nii lhood02.nii lhood03.nii mask.nii -popas M -foreach -push M -replace 0 NaN -times -endfor -vote-mrf VA 0.2 -o result.nii
8336 def run( 8337 self, 8338 execution: Execution, 8339 ) -> list[str]: 8340 """ 8341 Build command line arguments. This method is called by the main command. 8342 8343 Args: 8344 execution: The execution object. 8345 Returns: 8346 Command line arguments 8347 """ 8348 cargs = [] 8349 cargs.extend([ 8350 "-vote-mrf", 8351 self.vote_mrf 8352 ]) 8353 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8426@dataclasses.dataclass 8427class C3dVoxelIntegral: 8428 """ 8429 -voxel-integral: Print volume integral of all voxel intensities 8430 8431 Syntax: `-voxel-integral` 8432 8433 Like **-voxel-sum**, but multiplies the sum of voxel intensities by voxel 8434 volume. This is useful for computing volumes of objects represented by 8435 binary images. The result is in 'ml'. 8436 8437 $ c3d image.img -voxel-integral 8438 Voxel Integral: 2341. 8439 """ 8440 voxel_integral: str 8441 """-voxel-integral: Print volume integral of all voxel intensities 8442 8443 Syntax: `-voxel-integral` 8444 8445 Like **-voxel-sum**, but multiplies the sum of voxel intensities by voxel 8446 volume. This is useful for computing volumes of objects represented by 8447 binary images. The result is in 'ml'. 8448 8449 $ c3d image.img -voxel-integral 8450 Voxel Integral: 2341""" 8451 8452 def run( 8453 self, 8454 execution: Execution, 8455 ) -> list[str]: 8456 """ 8457 Build command line arguments. This method is called by the main command. 8458 8459 Args: 8460 execution: The execution object. 8461 Returns: 8462 Command line arguments 8463 """ 8464 cargs = [] 8465 cargs.extend([ 8466 "-voxel-integral", 8467 self.voxel_integral 8468 ]) 8469 return cargs
-voxel-integral: Print volume integral of all voxel intensities
Syntax: -voxel-integral
Like -voxel-sum, but multiplies the sum of voxel intensities by voxel volume. This is useful for computing volumes of objects represented by binary images. The result is in 'ml'.
$ c3d image.img -voxel-integral Voxel Integral: 2341.
-voxel-integral: Print volume integral of all voxel intensities
Syntax: -voxel-integral
Like -voxel-sum, but multiplies the sum of voxel intensities by voxel volume. This is useful for computing volumes of objects represented by binary images. The result is in 'ml'.
$ c3d image.img -voxel-integral Voxel Integral: 2341
8452 def run( 8453 self, 8454 execution: Execution, 8455 ) -> list[str]: 8456 """ 8457 Build command line arguments. This method is called by the main command. 8458 8459 Args: 8460 execution: The execution object. 8461 Returns: 8462 Command line arguments 8463 """ 8464 cargs = [] 8465 cargs.extend([ 8466 "-voxel-integral", 8467 self.voxel_integral 8468 ]) 8469 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8384@dataclasses.dataclass 8385class C3dVoxelSum: 8386 """ 8387 -voxel-sum: Print sum of all voxel intensities 8388 8389 Syntax: `-voxel-sum ` 8390 8391 Print the sum of all voxels in the image. 8392 8393 $ c3d image.img -voxel-sum 8394 Voxel Sum: 200923123. 8395 """ 8396 voxel_sum: str 8397 """-voxel-sum: Print sum of all voxel intensities 8398 8399 Syntax: `-voxel-sum ` 8400 8401 Print the sum of all voxels in the image. 8402 8403 $ c3d image.img -voxel-sum 8404 Voxel Sum: 200923123""" 8405 8406 def run( 8407 self, 8408 execution: Execution, 8409 ) -> list[str]: 8410 """ 8411 Build command line arguments. This method is called by the main command. 8412 8413 Args: 8414 execution: The execution object. 8415 Returns: 8416 Command line arguments 8417 """ 8418 cargs = [] 8419 cargs.extend([ 8420 "-voxel-sum", 8421 self.voxel_sum 8422 ]) 8423 return cargs
-voxel-sum: Print sum of all voxel intensities
Syntax: -voxel-sum
Print the sum of all voxels in the image.
$ c3d image.img -voxel-sum Voxel Sum: 200923123.
-voxel-sum: Print sum of all voxel intensities
Syntax: -voxel-sum
Print the sum of all voxels in the image.
$ c3d image.img -voxel-sum Voxel Sum: 200923123
8406 def run( 8407 self, 8408 execution: Execution, 8409 ) -> list[str]: 8410 """ 8411 Build command line arguments. This method is called by the main command. 8412 8413 Args: 8414 execution: The execution object. 8415 Returns: 8416 Command line arguments 8417 """ 8418 cargs = [] 8419 cargs.extend([ 8420 "-voxel-sum", 8421 self.voxel_sum 8422 ]) 8423 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8472@dataclasses.dataclass 8473class C3dVoxelwiseRegression: 8474 """ 8475 -voxreg, -voxelwise-regression: Regression between two images 8476 8477 Syntax: `-voxreg regression_order ` 8478 8479 Perform regression between corresponding voxels in two images. This command 8480 takes two images as input, X and Y. This command finds parameters b\_0, 8481 b\_1, ..., b\_k, such that Y is best approximated by b\_0 + b\_1 * X + b\_2 8482 * X^2 + ... + b_k * X^k. Here is an example of linear regression. 8483 8484 $ c3d Y.nii X.nii -voxreg 2 8485 REGCOEFF[0] = 5.56935 8486 REGCOEFF[1] = 0.844024 8487 8488 $ c3d Y.nii X.nii -scale 0.844024 -shift 5.56935 -voxreg 2 8489 REGCOEFF[0] = 0 8490 REGCOEFF[1] = 1. 8491 """ 8492 voxelwise_regression: str 8493 """-voxreg, -voxelwise-regression: Regression between two images 8494 8495 Syntax: `-voxreg regression_order ` 8496 8497 Perform regression between corresponding voxels in two images. This command 8498 takes two images as input, X and Y. This command finds parameters b\_0, 8499 b\_1, ..., b\_k, such that Y is best approximated by b\_0 + b\_1 * X + b\_2 8500 * X^2 + ... + b_k * X^k. Here is an example of linear regression. 8501 8502 $ c3d Y.nii X.nii -voxreg 2 8503 REGCOEFF[0] = 5.56935 8504 REGCOEFF[1] = 0.844024 8505 8506 $ c3d Y.nii X.nii -scale 0.844024 -shift 5.56935 -voxreg 2 8507 REGCOEFF[0] = 0 8508 REGCOEFF[1] = 1""" 8509 8510 def run( 8511 self, 8512 execution: Execution, 8513 ) -> list[str]: 8514 """ 8515 Build command line arguments. This method is called by the main command. 8516 8517 Args: 8518 execution: The execution object. 8519 Returns: 8520 Command line arguments 8521 """ 8522 cargs = [] 8523 cargs.extend([ 8524 "-voxelwise-regression", 8525 self.voxelwise_regression 8526 ]) 8527 return cargs
-voxreg, -voxelwise-regression: Regression between two images
Syntax: -voxreg regression_order
Perform regression between corresponding voxels in two images. This command takes two images as input, X and Y. This command finds parameters b_0, b_1, ..., b_k, such that Y is best approximated by b_0 + b_1 * X + b_2
- X^2 + ... + b_k * X^k. Here is an example of linear regression.
$ c3d Y.nii X.nii -voxreg 2 REGCOEFF[0] = 5.56935 REGCOEFF[1] = 0.844024
$ c3d Y.nii X.nii -scale 0.844024 -shift 5.56935 -voxreg 2 REGCOEFF[0] = 0 REGCOEFF[1] = 1.
-voxreg, -voxelwise-regression: Regression between two images
Syntax: -voxreg regression_order
Perform regression between corresponding voxels in two images. This command takes two images as input, X and Y. This command finds parameters b_0, b_1, ..., b_k, such that Y is best approximated by b_0 + b_1 * X + b_2
- X^2 + ... + b_k * X^k. Here is an example of linear regression.
$ c3d Y.nii X.nii -voxreg 2 REGCOEFF[0] = 5.56935 REGCOEFF[1] = 0.844024
$ c3d Y.nii X.nii -scale 0.844024 -shift 5.56935 -voxreg 2 REGCOEFF[0] = 0 REGCOEFF[1] = 1
8510 def run( 8511 self, 8512 execution: Execution, 8513 ) -> list[str]: 8514 """ 8515 Build command line arguments. This method is called by the main command. 8516 8517 Args: 8518 execution: The execution object. 8519 Returns: 8520 Command line arguments 8521 """ 8522 cargs = [] 8523 cargs.extend([ 8524 "-voxelwise-regression", 8525 self.voxelwise_regression 8526 ]) 8527 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8530@dataclasses.dataclass 8531class C3dWarp: 8532 """ 8533 No description found. 8534 """ 8535 warp: str 8536 """No description found.""" 8537 8538 def run( 8539 self, 8540 execution: Execution, 8541 ) -> list[str]: 8542 """ 8543 Build command line arguments. This method is called by the main command. 8544 8545 Args: 8546 execution: The execution object. 8547 Returns: 8548 Command line arguments 8549 """ 8550 cargs = [] 8551 cargs.extend([ 8552 "-warp", 8553 self.warp 8554 ]) 8555 return cargs
No description found.
8538 def run( 8539 self, 8540 execution: Execution, 8541 ) -> list[str]: 8542 """ 8543 Build command line arguments. This method is called by the main command. 8544 8545 Args: 8546 execution: The execution object. 8547 Returns: 8548 Command line arguments 8549 """ 8550 cargs = [] 8551 cargs.extend([ 8552 "-warp", 8553 self.warp 8554 ]) 8555 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8558@dataclasses.dataclass 8559class C3dWarpLabel: 8560 """ 8561 No description found. 8562 """ 8563 warp_label: str 8564 """No description found.""" 8565 8566 def run( 8567 self, 8568 execution: Execution, 8569 ) -> list[str]: 8570 """ 8571 Build command line arguments. This method is called by the main command. 8572 8573 Args: 8574 execution: The execution object. 8575 Returns: 8576 Command line arguments 8577 """ 8578 cargs = [] 8579 cargs.extend([ 8580 "-warp-label", 8581 self.warp_label 8582 ]) 8583 return cargs
No description found.
8566 def run( 8567 self, 8568 execution: Execution, 8569 ) -> list[str]: 8570 """ 8571 Build command line arguments. This method is called by the main command. 8572 8573 Args: 8574 execution: The execution object. 8575 Returns: 8576 Command line arguments 8577 """ 8578 cargs = [] 8579 cargs.extend([ 8580 "-warp-label", 8581 self.warp_label 8582 ]) 8583 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8650@dataclasses.dataclass 8651class C3dWeightedSum: 8652 """ 8653 -wsum, -weighted-sum: Weighed sum of images with constant weights 8654 8655 Syntax: `-wsum weight1 weight2 ... weightN ` 8656 8657 Computes weighted sum of the last N images on the stack. 8658 8659 c3d image1.nii image2.nii image3.nii -wsum 0.2 0.7 0.1 -o wsum.nii 8660 8661 This command is particularly useful for combining components in a 8662 multicomponent image. For example, for an RGB image, we can convert it to 8663 grayscale (using [ImageMagick][13] formula) as follows: 8664 8665 c3d -mcs rgb.nii -wsum 0.29900 0.58700 0.11400 -o gray.nii. 8666 """ 8667 weighted_sum: str 8668 """-wsum, -weighted-sum: Weighed sum of images with constant weights 8669 8670 Syntax: `-wsum weight1 weight2 ... weightN ` 8671 8672 Computes weighted sum of the last N images on the stack. 8673 8674 c3d image1.nii image2.nii image3.nii -wsum 0.2 0.7 0.1 -o wsum.nii 8675 8676 This command is particularly useful for combining components in a 8677 multicomponent image. For example, for an RGB image, we can convert it to 8678 grayscale (using [ImageMagick][13] formula) as follows: 8679 8680 c3d -mcs rgb.nii -wsum 0.29900 0.58700 0.11400 -o gray.nii""" 8681 8682 def run( 8683 self, 8684 execution: Execution, 8685 ) -> list[str]: 8686 """ 8687 Build command line arguments. This method is called by the main command. 8688 8689 Args: 8690 execution: The execution object. 8691 Returns: 8692 Command line arguments 8693 """ 8694 cargs = [] 8695 cargs.extend([ 8696 "-weighted-sum", 8697 self.weighted_sum 8698 ]) 8699 return cargs
-wsum, -weighted-sum: Weighed sum of images with constant weights
Syntax: -wsum weight1 weight2 ... weightN
Computes weighted sum of the last N images on the stack.
c3d image1.nii image2.nii image3.nii -wsum 0.2 0.7 0.1 -o wsum.nii
This command is particularly useful for combining components in a multicomponent image. For example, for an RGB image, we can convert it to grayscale (using [ImageMagick][13] formula) as follows:
c3d -mcs rgb.nii -wsum 0.29900 0.58700 0.11400 -o gray.nii.
-wsum, -weighted-sum: Weighed sum of images with constant weights
Syntax: -wsum weight1 weight2 ... weightN
Computes weighted sum of the last N images on the stack.
c3d image1.nii image2.nii image3.nii -wsum 0.2 0.7 0.1 -o wsum.nii
This command is particularly useful for combining components in a multicomponent image. For example, for an RGB image, we can convert it to grayscale (using [ImageMagick][13] formula) as follows:
c3d -mcs rgb.nii -wsum 0.29900 0.58700 0.11400 -o gray.nii
8682 def run( 8683 self, 8684 execution: Execution, 8685 ) -> list[str]: 8686 """ 8687 Build command line arguments. This method is called by the main command. 8688 8689 Args: 8690 execution: The execution object. 8691 Returns: 8692 Command line arguments 8693 """ 8694 cargs = [] 8695 cargs.extend([ 8696 "-weighted-sum", 8697 self.weighted_sum 8698 ]) 8699 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8702@dataclasses.dataclass 8703class C3dWeightedSumVoxelwise: 8704 """ 8705 -wsv, -weighed-sum-voxelwise: Weighed sum of images with spatially varying 8706 weights 8707 8708 Syntax: `-wsv ` 8709 8710 Computes weighted sum of N weight images and N scalar images. The images 8711 must be interleaved on the stack. All images on the stack are used. 8712 8713 c3d weight1.nii image1.nii weight2.nii image2.nii weight3.nii image3.nii 8714 -wsv -o mysum.nii.gz 8715 8716 The **-reorder** command can simplify loading the images: 8717 8718 c3d weight*.nii image*.nii -reorder 0.5 -wsv -o mysum.nii.gz 8719 8720 ### Commands: Image Header Manipulation. 8721 """ 8722 weighted_sum_voxelwise: str 8723 """-wsv, -weighed-sum-voxelwise: Weighed sum of images with spatially 8724 varying weights 8725 8726 Syntax: `-wsv ` 8727 8728 Computes weighted sum of N weight images and N scalar images. The images 8729 must be interleaved on the stack. All images on the stack are used. 8730 8731 c3d weight1.nii image1.nii weight2.nii image2.nii weight3.nii image3.nii 8732 -wsv -o mysum.nii.gz 8733 8734 The **-reorder** command can simplify loading the images: 8735 8736 c3d weight*.nii image*.nii -reorder 0.5 -wsv -o mysum.nii.gz 8737 8738 ### Commands: Image Header Manipulation""" 8739 8740 def run( 8741 self, 8742 execution: Execution, 8743 ) -> list[str]: 8744 """ 8745 Build command line arguments. This method is called by the main command. 8746 8747 Args: 8748 execution: The execution object. 8749 Returns: 8750 Command line arguments 8751 """ 8752 cargs = [] 8753 cargs.extend([ 8754 "-weighted-sum-voxelwise", 8755 self.weighted_sum_voxelwise 8756 ]) 8757 return cargs
-wsv, -weighed-sum-voxelwise: Weighed sum of images with spatially varying weights
Syntax: -wsv
Computes weighted sum of N weight images and N scalar images. The images must be interleaved on the stack. All images on the stack are used.
c3d weight1.nii image1.nii weight2.nii image2.nii weight3.nii image3.nii -wsv -o mysum.nii.gz
The -reorder command can simplify loading the images:
c3d weight.nii image.nii -reorder 0.5 -wsv -o mysum.nii.gz
Commands: Image Header Manipulation.
-wsv, -weighed-sum-voxelwise: Weighed sum of images with spatially varying weights
Syntax: -wsv
Computes weighted sum of N weight images and N scalar images. The images must be interleaved on the stack. All images on the stack are used.
c3d weight1.nii image1.nii weight2.nii image2.nii weight3.nii image3.nii -wsv -o mysum.nii.gz
The -reorder command can simplify loading the images:
c3d weight.nii image.nii -reorder 0.5 -wsv -o mysum.nii.gz
Commands: Image Header Manipulation
8740 def run( 8741 self, 8742 execution: Execution, 8743 ) -> list[str]: 8744 """ 8745 Build command line arguments. This method is called by the main command. 8746 8747 Args: 8748 execution: The execution object. 8749 Returns: 8750 Command line arguments 8751 """ 8752 cargs = [] 8753 cargs.extend([ 8754 "-weighted-sum-voxelwise", 8755 self.weighted_sum_voxelwise 8756 ]) 8757 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8586@dataclasses.dataclass 8587class C3dWrap: 8588 """ 8589 -wrap: Wrap (rotate) image 8590 8591 Syntax: `-wrap <vector> ` 8592 8593 Wrap image around one or more voxel dimensions. Wrapping is typically used 8594 to correct for MRI wrap-around artifacts. The vector must have integer 8595 components, possibly negative. For example, 8596 8597 c3d badmri.nii.gz -wrap 0x20x0 -o fixedmri.nii.gz 8598 8599 will wrap the image in the second voxel dimension by 20 voxels (i.e., voxel 8600 at 10x40x20 will me moved to the position 10x20x20). 8601 8602 8603 ### Commands: Options and Parameters 8604 8605 Options change the behavior of commands that *appear later on the command 8606 line*. This is very important. Specifying options after the command will 8607 have no effect. 8608 """ 8609 wrap: str 8610 """-wrap: Wrap (rotate) image 8611 8612 Syntax: `-wrap <vector> ` 8613 8614 Wrap image around one or more voxel dimensions. Wrapping is typically used 8615 to correct for MRI wrap-around artifacts. The vector must have integer 8616 components, possibly negative. For example, 8617 8618 c3d badmri.nii.gz -wrap 0x20x0 -o fixedmri.nii.gz 8619 8620 will wrap the image in the second voxel dimension by 20 voxels (i.e., voxel 8621 at 10x40x20 will me moved to the position 10x20x20). 8622 8623 8624 ### Commands: Options and Parameters 8625 8626 Options change the behavior of commands that *appear later on the command 8627 line*. This is very important. Specifying options after the command will 8628 have no effect.""" 8629 8630 def run( 8631 self, 8632 execution: Execution, 8633 ) -> list[str]: 8634 """ 8635 Build command line arguments. This method is called by the main command. 8636 8637 Args: 8638 execution: The execution object. 8639 Returns: 8640 Command line arguments 8641 """ 8642 cargs = [] 8643 cargs.extend([ 8644 "-wrap", 8645 self.wrap 8646 ]) 8647 return cargs
-wrap: Wrap (rotate) image
Syntax: -wrap <vector>
Wrap image around one or more voxel dimensions. Wrapping is typically used to correct for MRI wrap-around artifacts. The vector must have integer components, possibly negative. For example,
c3d badmri.nii.gz -wrap 0x20x0 -o fixedmri.nii.gz
will wrap the image in the second voxel dimension by 20 voxels (i.e., voxel at 10x40x20 will me moved to the position 10x20x20).
Commands: Options and Parameters
Options change the behavior of commands that appear later on the command line. This is very important. Specifying options after the command will have no effect.
-wrap: Wrap (rotate) image
Syntax: -wrap <vector>
Wrap image around one or more voxel dimensions. Wrapping is typically used to correct for MRI wrap-around artifacts. The vector must have integer components, possibly negative. For example,
c3d badmri.nii.gz -wrap 0x20x0 -o fixedmri.nii.gz
will wrap the image in the second voxel dimension by 20 voxels (i.e., voxel at 10x40x20 will me moved to the position 10x20x20).
Commands: Options and Parameters
Options change the behavior of commands that appear later on the command line. This is very important. Specifying options after the command will have no effect.
8630 def run( 8631 self, 8632 execution: Execution, 8633 ) -> list[str]: 8634 """ 8635 Build command line arguments. This method is called by the main command. 8636 8637 Args: 8638 execution: The execution object. 8639 Returns: 8640 Command line arguments 8641 """ 8642 cargs = [] 8643 cargs.extend([ 8644 "-wrap", 8645 self.wrap 8646 ]) 8647 return cargs
Build command line arguments. This method is called by the main command.
Arguments:
- execution: The execution object.
Returns:
Command line arguments
8768def c3d_( 8769 input_: list[InputPathType], 8770 operations: typing.Union[C3dAccum, C3dAcos, C3dAdd, C3dAlignLandmarks, C3dAnisotropicDiffusion, C3dAntialias, C3dSet, C3dAsin, C3dAtan2, C3dBackground, C3dN4BiasCorrection, C3dBinarize, C3dCanny, C3dCeil, C3dCentroid, C3dCentroidMark, C3dConnectedComponents, C3dClear, C3dClip, C3dColorMap, C3dCompress, C3dNoCompress, C3dConv, C3dCoordinateMapVoxel, C3dCoordinateMapPhysical, C3dCopyTransform, C3dCos, C3dCreate, C3dDicomSeriesList, C3dDicomSeriesRead, C3dDilate, C3dDivide, C3dDuplicate, C3dEndaccum, C3dEndfor, C3dErode, C3dErf, C3dExp, C3dExportPatches, C3dExportPatchesAug, C3dExtrudeSeg, C3dFillBackgroundWithNoise, C3dFft, C3dFlip, C3dFloor, C3dForeach, C3dForeachComp, C3dGlm, C3dGradient, C3dHelp, C3dHolefill, C3dHessianEigenvalues, C3dHessianObjectness, C3dHistogramMatch, C3dInfo, C3dInfoFull, C3dInsert, C3dInterpolation, C3dIterations, C3dLabelOverlap, C3dLabelStatistics, C3dLandmarksToSpheres, C3dLaplacian, C3dLevelset, C3dLevelsetCurvature, C3dLevelsetAdvection, C3dLog, C3dLog10, C3dManual, C3dMatchBoundingBox, C3dMaximum, C3dMulticomponentSplit, C3dMean, C3dMedianFilter, C3dMerge, C3dMeanFilter, C3dMutualInfo, C3dMinimum, C3dMixtureModel, C3dMoments, C3dMattesMutualInfo, C3dMeanSquare, C3dMultiply, C3dNormalizedCrossCorrelation, C3dNormalizedCorrelation, C3dNormalizedMutualInfo, C3dNoiseGaussian, C3dNoisePoisson, C3dNoiseSpeckle, C3dNoiseSaltPepper, C3dNoMulticomponentSplit, C3dNormalizeLocalWindow, C3dNormpdf, C3dNoround, C3dNospm, C3dOutput, C3dOutputMulticomponent, C3dOutputMultipleMulticomponent, C3dOrient, C3dOutputMultiple, C3dOrient_, C3dOrigin, C3dOriginVoxel, C3dOriginVoxelCoord, C3dOverlap, C3dOverlayLabelImage, C3dPad, C3dPadTo, C3dPca, C3dPercentIntensityMode, C3dPixel, C3dPop, C3dPopas, C3dProbe, C3dPush, C3dRank, C3dReciprocal, C3dRegion, C3dReorder, C3dRetainLabels, C3dRfApply, C3dRfTrain, C3dRfParamPatch, C3dRfParamUsexyz, C3dRfParamNousexyz, C3dRfParamNtrees, C3dRfParamTreedepth, C3dSetSform, C3dReplace, C3dResample, C3dResampleIso, C3dResampleMm, C3dResliceItk, C3dResliceMatrix, C3dResliceIdentity, C3dRgb2hsv, C3dRms, C3dRound, C3dScale, C3dSetSform_, C3dSin, C3dSlice, C3dSliceAll, C3dSharpen, C3dShift, C3dSignedDistanceTransform, C3dSmooth, C3dSmoothFast, C3dSpacing, C3dSplit, C3dSqrt, C3dStaple, C3dStructureTensorEigenvalues, C3dSpm, C3dSubtract, C3dSupervoxel, C3dStretch, C3dSwapdim, C3dTestImage, C3dTestProbe, C3dThreshold, C3dTile, C3dTrim, C3dTrimToSize, C3dType, C3dVerbose, C3dNoverbose, C3dVersion, C3dVote, C3dVoteMrf, C3dVoteLabel, C3dVoxelSum, C3dVoxelIntegral, C3dVoxelwiseRegression, C3dWarp, C3dWarpLabel, C3dWrap, C3dWeightedSum, C3dWeightedSumVoxelwise], 8771 output: str, 8772 runner: Runner | None = None, 8773) -> C3dOutputs: 8774 """ 8775 C3D is a command-line tool for medical image processing. 8776 8777 Author: ITK-Snap Team 8778 8779 Args: 8780 input_: The input image to process. 8781 operations: The operations to perform. 8782 output: The output image. 8783 runner: Command runner. 8784 Returns: 8785 NamedTuple of outputs (described in `C3dOutputs`). 8786 """ 8787 runner = runner or get_global_runner() 8788 execution = runner.start_execution(C3D_METADATA) 8789 cargs = [] 8790 cargs.append("c3d") 8791 cargs.append(" ".join([execution.input_file(f) for f in input_])) 8792 cargs.extend(operations.run(execution)) 8793 cargs.extend([ 8794 "-o", 8795 output 8796 ]) 8797 ret = C3dOutputs( 8798 root=execution.output_file("."), 8799 ) 8800 execution.run(cargs) 8801 return ret
C3D is a command-line tool for medical image processing.
Author: ITK-Snap Team
Arguments:
- input_: The input image to process.
- operations: The operations to perform.
- output: The output image.
- runner: Command runner.
Returns:
NamedTuple of outputs (described in
C3dOutputs).